When socket encounters the problem of message notification brought by token

The

requirement is very general, which is similar to the message notification in the top column of sf.
I use socket for instant notification here. Login uses auth token. There is no problem with these two implementations.
problem: when a user logs in and is logged in, the backend sends a notification through socket, and the frontend listens to the specified channel to obtain data. Everything is fine. When it takes 20 minutes for the user to close the browser, another message is sent from the backend, but the browser does not receive it. When the user opens the application, there is no login step because the token is stored locally (the token is legal). Then this message cannot be added to the top message bar (of course, if you go to the message list, you can definitely see it).
I hope to give you a good suggestion (excuse me for being a little verbose)

Feb.28,2021

won't the browser automatically disconnect when socket is off?


what I understand is that you only need to render the number of unread messages to prompt the user when he opens the page.

Menu