@@ -500,6 +500,16 @@ async def start_websocket_connection():
500500 )
501501 self ._record_activity ()
502502 self .log .info (f"Websocket connection established to { client_uri } " )
503+ if (
504+ subprotocols
505+ and self .ws .selected_subprotocol != self .selected_subprotocol
506+ ):
507+ self .log .warn (
508+ f"Websocket subprotocol between proxy/server ({ self .ws .selected_subprotocol } ) "
509+ f"became different than for client/proxy ({ self .selected_subprotocol } ) "
510+ "due to https://github.com/jupyterhub/jupyter-server-proxy/issues/459. "
511+ f"Requested subprotocols were { subprotocols } ."
512+ )
503513
504514 # Wait for the WebSocket to be connected before resolving.
505515 # Otherwise, messages sent by the client before the
@@ -539,7 +549,8 @@ def select_subprotocol(self, subprotocols):
539549 Note that this subprotocol selection should really be delegated to the
540550 server we proxy to, but we don't! For this to happen, we would need to
541551 delay accepting the handshake with the client until we have successfully
542- handshaked with the server.
552+ handshaked with the server. This issue is tracked via
553+ https://github.com/jupyterhub/jupyter-server-proxy/issues/459.
543554
544555 Overrides `tornado.websocket.WebSocketHandler.select_subprotocol` that
545556 includes an informative docstring:
@@ -549,7 +560,6 @@ def select_subprotocol(self, subprotocols):
549560 self .log .debug (
550561 f"Client sent subprotocols: { subprotocols } , selecting the first"
551562 )
552- # TODO: warn if we select one out of multiple!
553563 return subprotocols [0 ]
554564 return None
555565
0 commit comments