[Libwebsockets] permessage-deflate: selective deflate?
Andy Green
andy at warmcat.com
Tue Jun 29 20:39:43 CEST 2021
On 6/29/21 4:39 PM, Felipe Gasper wrote:
> Hello,
>
> WebSocket’s compression extension allows for selective compression: this message compressed, the next uncompressed, etc.
>
> This is advantageous for applications like terminals, where individual messages will only be a byte or two each.
I am not sure how much it matters for that. If you don't accumulate the
data into larger blocks, which you don't want for terminal IO where
latency is critical, you are anyway going to get the ws framing around
your "byte or two". If it's almost all "byte or two" then just don't
negotiate permessage-deflate.
> Does LWS’s lws_extension_callback_pm_deflate() expose any way to send an uncompressed message even when the compression extension is enabled?
Not as it stands. It does understand the p-m-d framing bit for RX
purposes and go around zlib appropriately. But atm if you negotiated
it, it will use it on all tx.
If you want to add it, the way is probably via an
LWS_WRITE_NO_COMPRESSION flag for lws_write(). But you'll need to scope
out the path in lws_write() to go around and test it.
-Andy
More information about the Libwebsockets
mailing list