Message compression
Hi,
I want to enable the perMessageDeflate option on my Node.js Socket.IO server to compress messages and reduce bandwidth usage. However, it seems the C# client does not support or acknowledge the compression, while the JavaScript client handles the compressed messages without any problems.
Thanks,
You can try SocketIOOptions.ExtraHeaders,I think it can be like this : ExtraHeaders.add("Sec-WebSocket-Extensions","permessage-deflate; client_max_window_bits")
I researched this topic and found the following:
- Permessage-deflate is not managed by Socket.IO but is a feature of WebSocket clients.
- The default WebSocket client used by the library (Net Standard ClientWebSocket) does not support the permessage-deflate option.
- A possible solution is to implement the IClientWebSocket interface and use a different WebSocket client.
Thank you for your suggestion, but unfortunately, it didn’t work. This seems to be expected behavior, as adding the header signals to the server that we can receive compressed data, even though the default WebSocket cannot decompress it. Without the header, the server assumes we cannot decompress and sends uncompressed data, even if data compression is enabled.