Next.js Discord

Discord Forum

Keep websockets alive when TAB in background

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hello guys!

Im currently trying to solve a problem that im facing.

I have an 5v5 MATCHMAKING platform just like FACEIT, and the issue im facing is when the user has the tab of the platform in the background or its not focused, when a match is found for that user the websockets event wont arrive and he wont be notified.

Is there any way that i can make the websockets persist forever basically till the tab is closed for good?

Im also using PUSH NOTIFICATIONS to notify the user about that match found, but the issue with it is that it cant play sounds, which makes it easy to not notice.

Any help?

1 Reply

Saint Hubert Jura Hound
What do you use to set up the websocket connection? Ws connections are kept alive using ping-pongs which the server is responsible for sending. I know socketio do this automatically but other implementations might not