https://github.com/hyperpy/simple-message-channels
Sans I/O wire protocol for Hypercore
https://github.com/hyperpy/simple-message-channels
hypercore hypercore-protocol
Last synced: 14 days ago
JSON representation
Sans I/O wire protocol for Hypercore
- Host: GitHub
- URL: https://github.com/hyperpy/simple-message-channels
- Owner: hyperpy
- License: gpl-3.0
- Created: 2020-07-07T10:53:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-05T06:16:49.000Z (over 5 years ago)
- Last Synced: 2024-08-08T23:45:50.578Z (over 1 year ago)
- Topics: hypercore, hypercore-protocol
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-message-channels
[](https://drone.autonomic.zone/hyperpy/simple-message-channels)
## Sans I/O wire protocol for Hypercore
## Install
```sh
$ pip install simple-message-channels
```
## Example
```python
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:
```sh
sent: b'\x04\x01foo'
received: [(0, 1, b'foo')]
```