akka-http icon indicating copy to clipboard operation
akka-http copied to clipboard

Support for WebSocket Extensions

Open johanandren opened this issue 8 years ago • 13 comments

Continuation of akka/akka#18709 We currently do not support websocket extensions (i.e. registering "an extension" in the server, or requesting one in the client).

Currently we see no strong need to provide this functionality. If you have a strong use case for it, please comment here

johanandren avatar Dec 15 '16 13:12 johanandren

One example use case: web socket compression, current draft: https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-28

Nice overview here: https://www.igvita.com/2013/11/27/configuring-and-optimizing-websocket-compression/

Implementing this either requires a way to register such an extension or to implement it internally in Akka HTTP. I think that even if we would implement permessage ourselves it would be nice if it was done through an extension API rather than directly in the blueprints etc.

johanandren avatar Dec 15 '16 13:12 johanandren

Note that the original ticket was closed because of lack of interest in it.

johanandren avatar Dec 15 '16 13:12 johanandren

Final version of the standard seems to be RFC 7692

One reason it is not completely trivial to implement is that JDK Deflate doesn't support setting window sizes to limit the amount of memory a receiver needs to keep between decompressing chunks.

jrudolph avatar Dec 15 '16 13:12 jrudolph

@jrudolph org.jcraft.jzlib supports setting the window size.

dleclere avatar Dec 29 '16 08:12 dleclere

+1 for compression

malibuworkcrew avatar Nov 14 '17 18:11 malibuworkcrew

Compression would be very good for my team's use cases too.

acjay avatar Mar 14 '18 16:03 acjay

It's been difficult to track exactly what the state of the art is in Web Sockets compression support, but it seems like most of the major browsers send headers related to compression: Sec-WebSocket-Extensions: permessage-deflate for Firefox and Chrome Sec-WebSocket-Extensions: x-webkit-deflate-frame for Safari

It seems like it should be possible for Akka HTTP to take this into account and enable compression when requested.

acjay avatar Apr 06 '18 13:04 acjay

The issue so far remains a low priority for us; if you'd like to give implementing this a shot, that would be very welcome though @acjay :-) Thanks in advance!

ktoso avatar Apr 09 '18 04:04 ktoso

+1

mikx avatar Mar 25 '20 20:03 mikx

+1

mrubinwch avatar Feb 17 '21 04:02 mrubinwch

+1, Is there any update on the server side compression?

gw-gdm avatar Aug 22 '21 17:08 gw-gdm

Compression is a use case for my team as well. We have a kind of request response pattern over the websocket and sometimes our responses are large around 1 to 4 MB.

Now we put up a manual compression over it and we observed that the data size becomes 7% of what it was and the time between such a request and its response becomes 35% of what it was.

Now, the problem with such a custom method is that debugging the websocket messages becomes a huge pain. I don't want to decompress every message for debugging some problem. For that reason we're not taking this to prod.

I believe compression itself is a strong enough reason to support it natively.

prongs avatar Dec 06 '21 11:12 prongs

Websocket compression would be needed for my team as well!

FredGithub avatar Dec 15 '21 12:12 FredGithub