Skip to content

Commit 56ef553

Browse files
authored
Support websocket compression
`jupyter-server-proxy`'s websocket connection (`PingableWSClientConnection`) does not support WS compression. When using `jupyter-server-proxy` to proxy a websocket connection, the handshake that occurs during the upgrade only takes into account the proxied websocket server's preferences. That server may (and often will) support compression schemes such as `permessage-deflate`. In this case, the client will use that compression scheme which will trigger an error in `jupyter-server-proxy` / `tornado` code. The fix is fairly simple: `PingableWSClientConnection` should support all compression schemes and let the client and the proxied server decide how they should communicate.
1 parent d3695dd commit 56ef553

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

jupyter_server_proxy/websocket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ def pingable_ws_connect(request=None, on_message_callback=None,
5151
# for tornado 4.5.x compatibility
5252
if version_info[0] == 4:
5353
conn = PingableWSClientConnection(io_loop=ioloop.IOLoop.current(),
54+
compression_options={},
5455
request=request,
5556
on_message_callback=on_message_callback,
5657
on_ping_callback=on_ping_callback)
5758
else:
5859
conn = PingableWSClientConnection(request=request,
60+
compression_options={},
5961
on_message_callback=on_message_callback,
6062
on_ping_callback=on_ping_callback,
6163
max_message_size=getattr(websocket, '_default_max_message_size', 10 * 1024 * 1024))

0 commit comments

Comments
 (0)