'Receive alerts to a multipage application using WebSockets

I have created one POC for alerts using WebSockets. Where I am using AWS Socket API gateway for server side implementation and WebSocket JS API in client side.

Now I need to integrate WebSockets with a multipage application and need to get alerts. But I can't use same websocket instance in all the web pages, I have to open different web sockets for each page. Now I want to set some unique identifier for all the open sockets such that all the web pages for the logged in user in a particular browser have the same socket id, So that it will reduce the overhead of storing so many socket ids against one user sessionid.

So I want to know if it is possible with WebSocket API in JS or any other API is available which I can use to achieve this MultiSocket with same socket id kind of implementation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source