You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
3 years ago | |
---|---|---|
simple_message_channels | 3 years ago | |
test | 3 years ago | |
.drone.yml | 3 years ago | |
.gitignore | 3 years ago | |
CHANGELOG.md | 3 years ago | |
LICENSE | 3 years ago | |
README.md | 3 years ago | |
poetry.lock | 3 years ago | |
pyproject.toml | 3 years ago |
README.md
simple-message-channels
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')]