Files
flucto-heisskleber/tests/integration/mqtt_async.py
Felix Weiler 78ba98a587 Feature/async sources (#46)
* WIP: Added async file reader.

* Async resampling and synchronization refactored.

* Add async mqtt publisher. Remove queue from joint.

* Add async zmq publisher and subscriber.

* Modify integration tests for streaming.

* Name refactoring resampler.

* Added async source/sink to factory.

* Refactor joint and add integration tests.

* Add termcolor dev dependency

* Add conosole source and sink

* Add cli interface for different protocols

* Removed files unfit for merge.

* Fix review requests.

* Restore use of $MSB_CONFIG_DIR for now.

It seems that the default behaviour is not looking for
.config/heisskleber

* Remove version test, causing unnecessary failures.
2024-01-22 11:23:00 +01:00

19 lines
457 B
Python

import asyncio
from heisskleber.mqtt import AsyncMqttSubscriber, MqttConf
async def main():
conf = MqttConf(broker="localhost", port=1883, user="", password="")
sub = AsyncMqttSubscriber(conf, topic="#")
# async for topic, message in sub:
# print(message)
# _ = asyncio.create_task(sub.run())
while True:
topic, message = await sub.receive()
print(message)
if __name__ == "__main__":
asyncio.run(main())