In Bokeh 1.4 we implemented an onclose response on the Bokeh websocket. We used something like this to get to get a handle to a Bokeh websocket:
var webSocket = new WebSocket("ws://"+ window.location.href.split("//")[1] +"/ws?bokeh-protocol-version=1.1&bokeh-session-id="+sessionID, "bokeh");
webSocket.onclose = function() {
$(".lostconnection").show();
}
This however does not work in Bokeh 2.0 anymore. We now get an error:
raise ProtocolError(“Subprotocol header is not ‘bokeh’”)
I saw in the documentation of Bokeh 2.0 that bokeh-protocol-version is no longer used and that Bokeh now uses a token system, but I am not sure how to use the new system to get a handle to the websocket and trigger the onclose again.
How can we achieve this?


