Implement gzip compression on messages exchanged between Websocket Server and Client Endpoints written in Java

632 Views Asked by At

I don't see specific documentation around javax.websocket.Session's getBasicRemote() and getAsyncRemote()'s sendText() and sendBinary() methods as to how one could use gzip compression to transfer messages. I am writing a high performance messaging app that could send few hundreds of 1000s of messages per sec across peers. Some of these messages are small and some are big and could use gzip compression (90% less data transfer). Are there any special extensions to be used to get this per-message compression working in Jetty 9 or any other container?

Note: I am not developing a browser based websocket solution. The clients and servers are strictly Java clients that could work with any JSR-356 Websocket Container Implementation.

1

There are 1 best solutions below

0
Takahiko Kawasaki On

RFC 7692 (Compression Extensions for WebSocket) is an official specification for per-message compression. Jetty 9 supports the specification.