Plans for Mosquitto websockets to support stream compression?


I sniffed the request from MQTT Explorer to a Mosquitto broker websockets endpoint and it includes the required header for stream compression - Sec-WebSocket-Extensions: permessage-deflate:

GET /ws HTTP/1.1
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: xx
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: mqtt
Host: my-mosquitto-instance:1885

However the response from Mosquitto is not compressed. I can’t see anything in the docs referring to it to enable it.

Is there any support for compression? Are there any plans to add it? If not, has anyone put something like nginx in front of Mosquitto websockets with any success?

For this application there would potentially be very significant bandwidth cost savings by supporting compression.


Hi tomf84,

At the moment we don´t support compression for websockets and it is unlikely that we will see that in the OSS version of Mosquitto.
What we have done for other customers in such cases: They carried some of 50% of the development cost, to push implementation.

So far it is not scheduled, but if you are in dire need of a feature like this, contact us at and we can have a look on how this may fit into our roadmap :slight_smile: .