Skip to content

Commit

Permalink
Force legacy ws subprotocol when using gateway
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Emmanuel Pignot committed Aug 9, 2023
1 parent c5dc0f6 commit 2c46959
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jupyter_server/gateway/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from tornado.escape import json_decode, url_escape, utf8
from tornado.httpclient import HTTPRequest
from tornado.ioloop import IOLoop
from traitlets import Bool, Instance, Int
from traitlets import Bool, Instance, Int, Unicode

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

retry = Int(0)

# When opening ws connection to gateway, server already negotiated subprotocol with notebook client.
# Same protocol must be used for client and gateway, so legacy ws subprotocol for client is enforced here.
kernel_ws_protocol = Unicode("")

async def connect(self):
"""Connect to the socket."""
# websocket is initialized before connection
Expand Down

0 comments on commit 2c46959

Please sign in to comment.