Skip to content

Commit 2c46959

Browse files
author
Emmanuel Pignot
committed
Force legacy ws subprotocol when using gateway
Currently, ws subprotocols should be the same for notebook client and gateway since there is no serializer/deserializer between the 2 streams if subprotocols differ.
1 parent c5dc0f6 commit 2c46959

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jupyter_server/gateway/connections.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from tornado.escape import json_decode, url_escape, utf8
1313
from tornado.httpclient import HTTPRequest
1414
from tornado.ioloop import IOLoop
15-
from traitlets import Bool, Instance, Int
15+
from traitlets import Bool, Instance, Int, Unicode
1616

1717
from ..services.kernels.connection.base import BaseKernelWebsocketConnection
1818
from ..utils import url_path_join
@@ -30,6 +30,10 @@ class GatewayWebSocketConnection(BaseKernelWebsocketConnection):
3030

3131
retry = Int(0)
3232

33+
# When opening ws connection to gateway, server already negotiated subprotocol with notebook client.
34+
# Same protocol must be used for client and gateway, so legacy ws subprotocol for client is enforced here.
35+
kernel_ws_protocol = Unicode("")
36+
3337
async def connect(self):
3438
"""Connect to the socket."""
3539
# websocket is initialized before connection

0 commit comments

Comments
 (0)