Fixes after publishing
This commit is contained in:
parent
3a8c4e91da
commit
a4fb98ad52
19
README.md
19
README.md
@ -19,25 +19,10 @@ like the sync `Client`. Methods are *not* coroutines, they are non-blocking fun
|
|||||||
`await`. The only exception is accessing messages through `async for`.
|
`await`. The only exception is accessing messages through `async for`.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```python
|
|
||||||
import paho.mqtt.client as mqtt
|
|
||||||
import trio
|
|
||||||
from trio_paho_mqtt import AsyncClient
|
|
||||||
|
|
||||||
|
Please see `example.py` for a working example!
|
||||||
|
(example in README removed because it was not working)
|
||||||
|
|
||||||
async def handle_messages(client):
|
|
||||||
async for msg in client.messages():
|
|
||||||
print(f"Received msg: {msg}")
|
|
||||||
|
|
||||||
async with trio.open_nursery() as nursery:
|
|
||||||
sync_client = mqtt.Client()
|
|
||||||
client = AsyncClient(sync_client, nursery)
|
|
||||||
client.connect('mqtt.eclipse.org', 1883, 60)
|
|
||||||
client.subscribe(topic)
|
|
||||||
client.publish(topic, msg)
|
|
||||||
|
|
||||||
nursery.start_soon(handle_messages, client)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Related projects
|
## Related projects
|
||||||
- [gmqtt](https://github.com/wialon/gmqtt) - Uses asyncio and callbacks. Isn't compatible with trio.
|
- [gmqtt](https://github.com/wialon/gmqtt) - Uses asyncio and callbacks. Isn't compatible with trio.
|
||||||
|
@ -3,7 +3,7 @@ name = "trio-paho-mqtt-up1"
|
|||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
description = "MQTT support for the Trio async runtime using Paho (update fork)"
|
description = "MQTT support for the Trio async runtime using Paho (update fork)"
|
||||||
authors = ["Olivier (fork) <triopahomqtt.python@librepush.net>", "bkanuka (original maintainer) <bkanuka@gmail.com>"]
|
authors = ["Olivier (fork) <triopahomqtt.python@librepush.net>", "bkanuka (original maintainer) <bkanuka@gmail.com>"]
|
||||||
license = "Apache2"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{include = "trio_paho_mqtt"}]
|
packages = [{include = "trio_paho_mqtt"}]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user