websocket-manager icon indicating copy to clipboard operation
websocket-manager copied to clipboard

Return the same id to client on reload

Open marcuslindblom opened this issue 7 years ago • 2 comments

Is it possible to get the same id to the client even when the user reloads the web page? I would like to send notifications even though the user has navigated away from the initial page.

marcuslindblom avatar Jun 18 '17 18:06 marcuslindblom

There are several ways to accomplish this. FIrst of all, you need to keep some information about a user (id in a cookie for example). Then, keep a map of user ids and connection ids on the server.

Then, when you send a message to a connection id, send it to all connection ids associated to the user id.

radu-matei avatar Jun 18 '17 22:06 radu-matei

Ok, I see. Thanks!

marcuslindblom avatar Jun 19 '17 04:06 marcuslindblom