PerMessage is a WebSocket protocol extension, if the extension is supported by Server and Client, both can compress transmitted messages:
Uses Deflate as the compression method.
Compression only applies to Application data (control frames and headers are not affected).
Server and client can select which messages will be compressed.
This extension allows customizing Server and Client size of the sliding window used by LZ77 algorithm (between 8 - 15). As greater is this value, more probably will find and eliminate duplicates but consumes more memory and CPU cycles. 15 is the default value.
By default, previous messages are used to compression and decompression, if messages are similar, this improves the compression ratio. If Enabled, then each message is compressed using only its message data. By default is disabled.
This value is not negotiated between Server and Client. when set to 1, it uses the least memory, but slows down the compression algorithm and reduces the compression ratio; when set to 9, it uses the most memory and delivers the best performance. By default is set to 1.