gorilla / websocket

Package gorilla/websocket is a fast, well-tested and widely used WebSocket implementation for Go.
https://gorilla.github.io
BSD 2-Clause "Simplified" License
22.21k stars 3.48k forks source link

[feature] Support x-webkit-deflate-frame #696

Closed ejain closed 3 years ago

ejain commented 3 years ago

Some browsers (e.g. Safari) send Sec-WebSocket-Extensions: x-webkit-deflate-frame instead of the (now standard) permessage-deflate. The behavior should be identical, otherwise.

ghost commented 3 years ago

@ejain Please share a link to the x-webkit-deflate-frame specification if you have one. Based on the names alone, it seems like extensions do different things (compress one frame at a time vs. compress the concatenation of the frame data).

ejain commented 3 years ago

See comments on https://github.com/websockets/ws/issues/940, but it could be random luck that this works.

ghost commented 3 years ago

@ejain Thank you for the reference to the issue. Because a popular browser uses the extension, this issue should remain open.

ejain commented 3 years ago

As of iOS 15, Safari defaults to using NSURLSession Websocket, which uses the standard permessage-deflate headers, not x-webkit-deflate-frame. This new implementation doesn't work with gorilla/websocket (and likely other backends) as it fails when larger messages are split, but that's another issue...

imankur commented 2 years ago

@ejain This new implementation doesn't work with gorilla/websocket - any idea what can be the fix for this?