Replies: 1 comment
-
Same problem when an edge tab goes sleep (on desktop), there is no disconnect event fired on my server. And using server.fetchSocket() doesn't include the sleep tab. My solution for this is to maintain a heartbeat mechanism to check whether the tab is online. @soomyProd did you found any other solution? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question:
I'm working on a MERN stack application where I'm utilizing Socket.IO for real-time communication. Everything works well, but I'm facing an issue when the mobile device goes into sleep mode. The socket connection seems to be getting disrupted during this state (disconnected).
Context:
I have a backend setup using Node.js and Socket.IO, and on the frontend side, I'm using React with the useEffect hook to establish a socket connection when the component mounts. Here's a simplified version of my code:
Backend (socket.js):
Frontend (product.js):
Issue:
The socket connection works as expected, but when the mobile device goes to sleep mode, the connection seems to be lost. I've tried implementing a solution, but I'm unsure about the best approach to keep the socket connection active during sleep mode.
Request for Help:
socket connection when a mobile device goes into sleep mode?
Socket.IO to handle such scenarios?
on mobile devices, especially in the context of mobile web applications?
Any assistance or guidance would be greatly appreciated. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions