On Apr 9, 2018, at 10:06, 'Corey O'Meara' via Bokeh Discussion - Public <bokeh@continuum.io> wrote:
I’m away from the code right now but I believe if you search through bokehJS there’s a method called somewhere like “__on_open” for a websocket object. In that method I just have something like window.WS=_this
Then in my own JavaScript file which is also loaded (not using any “bokehJS callback”) I access the .WS variable and call the bokeh method “.close”.
Hi,
Looks like on the server side we can use bokeh.client.session (https://bokeh.pydata.org/en/latest/docs/reference/client/session.html\) which has `close` method.
If session is created with with `pull_session` (as mentioned here - https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#app-sessions\), we can do it with creating a custom API call to the application which in turn will access bokeh server to close the session from server side.
Yet, I am sure it can be done directly via BokehJS, but I don't find any references to it....
On Sunday, April 8, 2018 at 8:36:45 PM UTC+3, omearac wrote:
Hi Meir,
Yes this is possible but Im not sure if my way is sort of hacky... basically if you search through bokehJS theres an object related to the web socket connection. I've modified the bokehJS code to my own custom version so that when a WS connection is created I also create a new global object (set to the window for example). Then, now that I have this WS connection instance, you can call the bokeh defined '.close' function on it whenever you want.
In fact, theres slightly more to do to then 'cleanup' any remaining bokeh document related objects which can be found in the global 'Bokeh' object created by bokehJS..but thats the gist of it.
On Sun, Apr 8, 2018 at 6:07 PM, Meir Tseitlin <me...@imubit.com> wrote:
Hi,
I am using Bokeh server with `server_document` to display multiple frontend tabs (managed by external React). Each tab opens additional websocket.
Is it possible to somehow close an existing session, so websocket will be closed? Preferably via JS (via server side can also help).
Thanks
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8fde46d3-6c5b-485b-b47d-4727af387cc6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/b8ed1ac3-258a-4726-aa35-8f9bdccde9ff%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.