Skip to content

Commit

Permalink
Rename protocol 0.0.1 -> v1.websocket.jupyter.org
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Jan 24, 2022
1 parent c79b190 commit c540e28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions plugins/kernels/fps_kernels/kernel_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async def listen_web(self, websocket: AcceptedWebSocket):
send_message(msg, self.shell_channel, self.key)
elif channel == "control":
send_message(msg, self.control_channel, self.key)
elif websocket.accepted_subprotocol == "0.0.1":
elif websocket.accepted_subprotocol == "v1.websocket.jupyter.org":
while True:
msg = await websocket.websocket.receive_bytes()
# FIXME: add back message filtering
Expand Down Expand Up @@ -188,7 +188,7 @@ async def listen(self, channel_name: str):
msg = get_msg_from_parts(parts, parent_header=parent_header)
msg["channel"] = channel_name
await send_json_or_bytes(websocket.websocket, msg)
elif websocket.accepted_subprotocol == "0.0.1":
elif websocket.accepted_subprotocol == "v1.websocket.jupyter.org":
bin_msg = get_bin_msg_from_parts(channel_name, parts)
try:
await websocket.websocket.send_bytes(bin_msg)
Expand All @@ -205,7 +205,7 @@ async def listen(self, channel_name: str):
msg = get_msg_from_parts(parts, parent_header=parent_header)
msg["channel"] = channel_name
await send_json_or_bytes(websocket.websocket, msg)
elif websocket.accepted_subprotocol == "0.0.1":
elif websocket.accepted_subprotocol == "v1.websocket.jupyter.org":
bin_msg = get_bin_msg_from_parts(channel_name, parts)
await websocket.websocket.send_bytes(bin_msg)

Expand Down
6 changes: 5 additions & 1 deletion plugins/kernels/fps_kernels/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ async def kernel_channels(
if user:
accept_websocket = True
if accept_websocket:
subprotocol = "0.0.1" if "0.0.1" in websocket["subprotocols"] else None
subprotocol = (
"v1.websocket.jupyter.org"
if "v1.websocket.jupyter.org" in websocket["subprotocols"]
else None
)
await websocket.accept(subprotocol=subprotocol)
accepted_websocket = AcceptedWebSocket(websocket, subprotocol)
if kernel_id in kernels:
Expand Down

0 comments on commit c540e28

Please sign in to comment.