Web socket (STOMP) assistance

Good afternoon all, our application is leveraging a web socket connection to pull call data from our Avaya PBX.  It's working great, but there was a small oversight on our part.... when we developed the application we did NOT create a single page app, so the javascript that create the web socket connection is re-run each time the user navigate to a new screen.

Can anyone think of a work around (outside of redesigning everything as a single page app) that would keep the javascript/web socket active as the users navigate between a handful of pages?   

In our initial unit testing, navigating between pages does drop the socket but also sets it back up very quickly as the next page loads.   Obviously this isn't the best solution, but maybe it wouldn't harm anything going that route?      Any feedback would be greatly appreciated.


Hi Josh. Do all screens require the websocket connection? Perhaps you could limit them only to the screens that they are needed.


One possibility would be to use a service worker, depending on your browser compatibility (IE has no support for service workers). That should be doable, however it may require redesigning a lot of your code.

leonardo.fernandes wrote:

Hi Josh. Do all screens require the websocket connection? Perhaps you could limit them only to the screens that they are needed.


One possibility would be to use a service worker, depending on your browser compatibility (IE has no support for service workers). That should be doable, however it may require redesigning a lot of your code.


Yes all of the screens require the websocket connection.   Essentially this is a CRM so users may be wrapping up call notes or doing research on screens that contain historical transaction data.   When a new call arrives they will be notified and routed back to their dashboard screen where they can view the caller information.

Since the app is all internal users we can mandate a non IE browser, but I guess I’m not sure how a service worker functions, or how to implement in OS.

Hi Josh,

I have sent you an email with the OML where we did try this with SharedWorker.

Regards.