Mosquitto Websockets delays

I don’t know your setup, but as I said, you have misconfigured stuff, so any detail could have prevented it from working. If you correctly configure loraserver and lora-app-server to connect via tcp and your js client via websockets, you should be fine.

This is what I see from log lora-app-server; it’s the downlink message sent from javascript client:

time="2018-08-07T16:32:21+02:00" level=info msg="downlink device-queue item handled" confirmed=true dev_eui=0102030405060708 f_cnt=1

As far as python client, what I see into the log file is the following:

level=info msg="downlink device-queue item handled" confirmed=true dev_eui=0102030405060708 f_cnt=0

I see that the f_cnt for python is zero, while for javascript is 1.

Well, it seems you queued a message from python, then another from js and they both got handled. What’s the problem?

I don’t know…i’m trying every possibility without success. For example now I set python to use websockets on port 9001 client = mqtt.Client(transport='websockets').
Uplink messages are received, but downlink messages to send to device not turn on the lights…
On mosquitto conf I set listener 9001
I’m getting crazy

I meant to say that I didn’t see a problem with what you had posted.

I can’t say what is ok or wrong with your setup because I don’t know it. All I can say is that if you publish a message for downlink over mqtt and it gets added to the device queue (not necessarily sent, at least not immediately), then it works; if not, it doesn’t and you should check relevant logs (from your client, mosquitto, any auth plugin, etc.) to see why it could fail over websockets. If indeed it fails, I’d bet mosquitto logs would be the really useful ones if the clients are able to handle websockets (I know the JS client is at least).

Hi iegomez. I’m able to send command on off to my remote node. Not always the message is received by the node. But I think that is a problem of cooking hacks libraries for Arduino. So the lora server works perfectly

Hi all!
I’m happy to tell you that I found the problem about this topic. LoraServer is not the problem as I said previously.
The problem is Mosquitto, in particular the version 1.4.8. According to some forums this kind of version had several problems with the websockets: mosquitto introduced some delays when messages were sent. This is why sometimes the commands to turn on and off the light were not received by my device through the paho javascript libraries. So by installing the new version of mosquitto (1.4.15) the problem is solved and my command is received correctly each time I want to change the status of my light. Thank you all for your support!. @brocaar if you want you can close this topic!
Very beautiful project!
Regards, Stefano

1 Like