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 [email protected] 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 [email protected].
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 [email protected] 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 [email protected].
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”.
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 [email protected] 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 [email protected].
Just chiming in: feel free to open GH discussions if there are missing useful features around session management. There are definitely some things like timeout/disconnection notices, auto-reconnection, or manual reconnect options, etc that have crossed my mind but it would be good to have a wider discussion and see what people's real uses and needs are first.
Thanks,
Bryan
···
On Apr 9, 2018, at 10:06, 'Corey O'Meara' via Bokeh Discussion - Public <[email protected]> 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”.
If this doesn’t help I can post a snippet tmrw
On Apr 9, 2018, at 10:45 AM, Meir Tseitlin <[email protected]> wrote:
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 <[email protected]> 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).