iwanbk / nyamuk

Python MQTT Client Library Based on libmosquitto
BSD 2-Clause "Simplified" License
77 stars 23 forks source link

The test demo on README #24

Open xiaowenlong100 opened 7 years ago

xiaowenlong100 commented 7 years ago

I can't run it well when "ret = client.connect(version=4)" . "ret = client.connect(version=3)" will be OK.

gbour commented 7 years ago

version=4 enable mqtt 3.1.1 (latest protocol version), while version=3 stick to past 3.1 version. Which broker are you testing the demo with ? does it support mqtt v3.1.1 ?

xiaowenlong100 commented 7 years ago

Thank you .I got a 'emqttd-windows10-v2.1.2.zip' that I download from http://www.emqtt.io/ 。It could support mqtt 3.1.1 since version emqttd-v0.3.1.

gbour commented 7 years ago

yes, Emqtt is supporting Mqtt v3.1.1 Could you try with mosquitto tools (mosquitto_pub & mosquitto_sub) with option --protocol-version mqttv311

Could you also take & send a network trace when using nyamyk demo ?

tronar commented 6 years ago

I bumped in the same issue, seems a bug on the packet length that assumes version 3 ID (3.1, MQIsdp), which is longer than version 4 (3.1.1, MQTT). Solved by toast-uz by changing at line 123 of nyamuk/mqtt_pkt.py from: self.remaining_length = 12 + payload_len to: self.remaining_length = 6 + payload_len + len(getattr(NC, 'PROTOCOLNAME{0}'.format(version)))

elegentFrog commented 5 years ago

hello!excuse me,{ connection failed 2019-03-01 17:55:31,601 - test_nyamuk - INFO - Connecting to server ....192.168.8.7 2019-03-01 17:55:31,609 - test_nyamuk - INFO - CONNACK reveived error: Client(test_nyamuk@192.168.8.46:38106): Username 'undefined' login failed for password_undefined },how do you solve this problem?