-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket server compression does not work #494
Comments
@favila Good catch. I'm working on a WebSocket handling flow right now (mostly due to potential issues with leaked buffers). I've spotted the same issue, to make this work with need |
@favila This actually happens because we misuse There's no simple solution here, I would probably do the following:
Stay tuned and thanks for the reporting. |
The solution was already merged, closing the issue |
Websocket servers never actually upgrade to use compression, so the
:compression?
option onwebsocket-connection
actually does nothing.I've verified this by noting the returned headers in Chrome dev tools: Chrome asks for permessage-deflate, but the return headers never contain
Sec-WebSocket-Extensions: permessage-deflate
.I've also added breakpoints (in a java debugger) to the points where extension detection should happen, and those breakpoints are never reached.
Unfortunately I don't know how to test this using the public aleph api; I don't know how to write a
aleph.websocket-test
test that actually confirms compression is on after connection upgrade, from either the client or server side.The problem is that the
WebSocketServerCompressionHandler
added to the pipeline uses aWebSocketServerExtensionHandler
which turns extensions on by examining thechannelRead
event for aHttpRequest
message. However, this method never sees anyHttpRequest
messages. The first message it will see is an actual websocket message created by thenetty/channel-inbound-handler
created inaleph.http.server/websocket-server-handler
.I am a netty novice so I don't know how to fix this. This might be netty rather than an aleph bug (although I couldn't find any netty tickets that looked like this). It seems like the handshaker has an opportunity to re-fire the httprequest as a channel read, but that would require changing netty (I think) and I don't know if it's correct. An alternative is maybe to do the compression extension sniffing somewhere inside
initialize-websocket-handler
(i.e. reimplement most ofWebsocketServerExtensionHandler.channelRead()
) and add the appropriate compression handler to the pipeline directly (i.e. reimplementWebsocketServerExtensionHandler.write()
.)The text was updated successfully, but these errors were encountered: