hyperpy / simple-message-channels

Sans I/O wire protocol for Hypercore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple-message-channels

Build Status

Sans I/O wire protocol for Hypercore

Install

$ pip install simple-message-channels

Example

from simple_message_channels import SimpleMessageChannel

smc1 = SimpleMessageChannel()
smc2 = SimpleMessageChannel()

payload = smc1.send(0, 1, b"foo")
print(f"sent: {payload}")

for idx in range(0, len(payload)):
    smc2.recv(payload[idx : idx + 1])
print(f"received: {smc2.messages}")

Output:

sent: b'\x04\x01foo'
received: [(0, 1, b'foo')]

About

Sans I/O wire protocol for Hypercore

License:GNU General Public License v3.0


Languages

Language:Python 100.0%