Mosquitto: Enabling a websocket listener slows the broker down

Created on 27 Aug 2020  路  5Comments  路  Source: eclipse/mosquitto

My default listener uses tls, when I enable an extra listener with mqtt protocol, things work fine. When I switch the protocol to websockets my broker slows down. I use mosquitto version 1.6.7.

Default listener

SinusNormal

Default listener (with extra websocket listener enabled)
SinusBroken

Also the startup logs of mosquitto are slower printed and connecting to the broker via mqtt-explorer is slower. Any idea what produces this issue?

Most helpful comment

Windows uses libwebsockets 2.4 which has proved to be a reliable version. Some of the later versions have had problems. I don't know what you have with your 1.6.7 install of course.

Would you mind trying out the develop branch of Mosquitto? There have been improvements to the websockets support in that branch and I think they are enough to fix what you are seeing for all libwebsockets versions.

All 5 comments

So I cannot reproduce this on Windows. This seems having to do with our linux build, will look further into it. Do the linux binaries have websocket support enabled or is it just the windows installer?

Windows uses libwebsockets 2.4 which has proved to be a reliable version. Some of the later versions have had problems. I don't know what you have with your 1.6.7 install of course.

Would you mind trying out the develop branch of Mosquitto? There have been improvements to the websockets support in that branch and I think they are enough to fix what you are seeing for all libwebsockets versions.

Thx ralight! I will try it next week.

Thanks for the tip about libwebsockets!

I ran into this issue after enabling Mosquitto's websockets support on a Yocto Zeus -based embedded device. The device had Mosquitto 1.6.7 and libwebsockets 3.20.0 installed. I tried first upgrading to Mosquitto 1.6.12 from meta-oe master, but that didn't help. Then I found this ticket and after upgrading to libwebsockets 4.0.20, also from meta-oe master, the laggy behavior vanished.

Hey, thanks @jpnurmi for your solution. It fixed it for us too :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bootrino picture bootrino  路  7Comments

smarty70 picture smarty70  路  3Comments

HenryNe picture HenryNe  路  5Comments

Ben-Macri picture Ben-Macri  路  5Comments

chipengliu picture chipengliu  路  5Comments