delete all main objects on websocket connection closed

Hi all,

I am running a bokeh server (using the directory format) where the main application creates a TCP connection to a real time data stream and the plots the data as it comes in. Everything is running smoothly in general, when a user creates a websocket connection to the application a new TCP connection is created and the data begins plotting, however, things are never cleaned up when a user disconnects from the websocket. This is leaving a whole bunch of zombie TCP connections that are still receiving data uselessly.

I’m just wondering if there is a way to easily delete all the objects in main when the instance they belong to is diconnected. Now, I could probably do this using the server_lifecycle hooks but I feel like there needs to be an easier way. Does any one else have experience with this?