Consider adding in permessage-deflate support for websockets
Hello,
We use mosquitto as an MQTT broker for the websockets endpoint of SondeHub.org. As an experiment to try to save bandwidth costs I implemented permessage-deflate in websockets.c and we saw significant reduction in bandwidth consumed.

While having permessage-deflate likely isn't suitable for everyone I think making it a configurable option would be very hand for many users and the changes to code is very minimal.
The way I hacked it in was modifying websockets.c to add
static const struct lws_extension extensions[] = {
{
"permessage-deflate",
lws_extension_callback_pm_deflate,
"permessage-deflate"
"; client_no_context_takeover"
"; client_max_window_bits"
},
{ NULL, NULL, NULL /* terminator */ }
};
and in mosq_websockets_init add info.extensions = extensions; prior to lws_create_context
I then had to modify the docker file to include -lz in the linker for mosquitto build and changed LWS_WITHOUT_EXTENSIONS=OFF and -DLWS_WITH_ZLIB=ON in the lws build.
Thank you, it sounds sensible to have that as a configuration option.
fyi we are seeing segfaults with this approach under some loads / conditions. I haven't been able to debug further but thought you should be aware.