perMessageDeflate parameter to enable the permessage-deflate WebSocket extension. This negotiates compression with clients that support it; messages sent with ws.send() are still uncompressed unless you opt in per message (see below).
server.ts
To enable compression for individual messages, pass
true as the second parameter to ws.send(). This requires perMessageDeflate to be enabled; otherwise the message is sent uncompressed.
server.ts