simple-message-channels/README.md

37 lines
667 B
Markdown
Raw Normal View History

2020-06-29 23:53:17 +00:00
# simple-message-channels
2020-06-29 23:54:30 +00:00
[![Build Status](https://drone.autonomic.zone/api/badges/hyperpy/simple-message-channels/status.svg)](https://drone.autonomic.zone/hyperpy/simple-message-channels)
## Sans I/O wire protocol for Hypercore
2020-06-29 23:53:17 +00:00
2020-08-01 16:54:12 +00:00
> **Work In Progress**
2020-07-07 14:05:55 +00:00
## Install
2020-06-29 23:53:17 +00:00
```sh
$ pip install simple-message-channels
```
2020-07-07 14:05:55 +00:00
## Example
```python
2020-08-01 16:53:22 +00:00
from simple_message_channels import SimpleMessageChannel
2020-08-03 20:23:11 +00:00
smc_a = SimpleMessageChannel()
smc_b = SimpleMessageChannel()
2020-08-01 16:53:22 +00:00
2020-08-03 20:23:11 +00:00
payload = smc_b.send(0, 1, b"foo")
2020-08-01 16:53:22 +00:00
2020-08-03 20:23:11 +00:00
for idx in range(0, len(payload)):
smc_a.recv(payload[idx, idx + 1])
for msg in smc_a.messages:
print(f"received: {msg}")
2020-08-01 16:53:22 +00:00
```
Output:
```sh
2020-08-03 20:23:11 +00:00
(0, 1, b"foo")
2020-07-07 14:05:55 +00:00
```