We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following the example on the README i have a connect function defined like this (I'm not using
import asyncio import os import signal import time from gmqtt import Client as MQTTClient from gmqtt.mqtt.constants import MQTTv311 host = 'localhost' port = '1993' STOP = asyncio.Event() def on_connect(client, flags, rc, properties): print('Connected') client.subscribe('#', qos=0) def on_message(client, topic, payload, qos, properties): print('RECV MSG:', payload) def on_disconnect(client, packet, exc=None): print('Disconnected') def on_subscribe(client, mid, qos): print('SUBSCRIBED') def ask_exit(*args): STOP.set() async def main(broker_host, broker_port): client = MQTTClient("client-id") client.on_connect = on_connect client.on_message = on_message client.on_disconnect = on_disconnect client.on_subscribe = on_subscribe await client.connect(broker_host, broker_port, version=MQTTv311) await STOP.wait() await client.disconnect() if __name__ == '__main__': loop = asyncio.get_event_loop() loop.add_signal_handler(signal.SIGINT, ask_exit) loop.add_signal_handler(signal.SIGTERM, ask_exit) loop.run_until_complete(main(host, port))
Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/gmqtt/mqtt/handler.py", line 227, in __call__ result = self._handle_packet(cmd, packet) File "/usr/lib/python3.7/site-packages/gmqtt/mqtt/handler.py", line 124, in _handle_packet handler(cmd, packet) File "/usr/lib/python3.7/site-packages/gmqtt/mqtt/handler.py", line 179, in _handle_connack_packet self.on_connect(self, flags, result) TypeError: on_connect() missing 1 required positional argument: 'properties'
This will go away if I define the function as
def on_connect(client, flags, rc, properties=None): print('Connected') client.subscribe('#', qos=0)
The text was updated successfully, but these errors were encountered:
Hi @nicola-lunghi which gmqtt version do you use? As I see by your traceback, it's outdated, please upgrade to newest gmqtt==0.4.4 version
gmqtt
gmqtt==0.4.4
Sorry, something went wrong.
I think I got the latest from pypi but I'll double check thanks
You were right I was using 0.0.12. Thanks
No branches or pull requests
Following the example on the README i have a connect function defined like this (I'm not using
This will go away if I define the function as
The text was updated successfully, but these errors were encountered: