Edubits / Zway-MQTT

Publishes the status of devices to a MQTT topic and is able to set values based on subscribed topics.
Apache License 2.0
29 stars 16 forks source link

MQTT with Bluemix MQTT iothub #21

Open xapundel opened 7 years ago

xapundel commented 7 years ago

Hello Robin,

I am trying to use your MQTT module to connect my MQTT server in the bluemix. I got some initial problem with username and password. Why it should be less than 12 simbols ? I removed that limit but anyway have

[2017-03-07 01:09:58.106] [I] [core] [MQTT-12] Trying to reconnect (NaN)

Could you help me to solve the problem ? I created MQTT for your testing and sent all credential in the email.

Edubits commented 7 years ago

Why it should be less than 12 simbols ?

Good question! The MQTT 3.1 spec used by the MQTT client we're using (the only client known to me which is plain, non-websocket, JavaScript and therefor works within the limited JS of ZWay) recommends to keep the username and password within 12 chars, see: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#connect

As there are quite some calculations going on while composing the messages I can imagine there are some that assume a username/password within 12 chars. Are you able to try the broker with a shorter password? If that works we can dive into this.

xapundel commented 7 years ago

Based on spec is is not mandatory. I know a lot of project where MQTT pass is 256 symb. Unfortunately I have no option to change this password. Did you recieve my email with test credentials. I also tried another MQTT client and got good respons from MQTT server.

Edubits commented 7 years ago

Based on spec is is not mandatory.

I know, but as this MQTT client is a bit older and explicitly checks for the length, I'm afraid that somewhere they handle username/passwords longer than 12 chars incorrectly. Unfortunately the JS available to Zway apps is very limited, so this was the only MQTT client I could find that actually works.

Unfortunately I have no option to change this password. Did you recieve my email with test credentials. I also tried another MQTT client and got good respons from MQTT server

That's a pity. Yes I checked and confirmed it worked with another client. I didn't have the opportunity yet to test within Zway.