-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Socket.IO stops working randomly until page refresh #5299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi! That's really weird indeed, I guess you aren't able to reproduce it reliably? Does it happen in a given browser? Or after a specific delay? How do you detect it? |
Hi! Yeah, I can't reproduce the error consistently. It happens in any browser, and I believe it occurs after a certain amount of time. My application is a chat, so I'm sending messages normally, but at some point, I try to send a new message, and it just doesn't go through. The only way to make it work again is by refreshing the page. |
Without the ability to reproduce the issue, it will be quite hard to find the cause... We'd need to have access to the internal state of the client when that happens. Could it simply be a temporary disconnection? Or a missing event listener? |
I believe I might have the same problem -- I initially the issue was a result of updating python-socketio, but it seems that this started happening after updating socket.io-client on the client side from 4.7.5 to 4.8.1. When the socket.io-client tries establishing a connection, the Python server detects a successful connection, but there is an immediate disconnect. You can see the details here: miguelgrinberg/python-socketio#1434 After downgrading to 4.7.5, the issue seems to be gone. |
I was facing the same issue, it turned out that I was using nodemon, and whenever I was changing something in the server project, the server was restarting so the socket ids were changing on every server restart and by not refreshing the browser I was not registering the new ids. So after change in the server code refreshing the browser was only fix. |
Thank you for the response! I will try to do this downgrade. |
Just to give more info: the downgrade did not help at all , and we are still facing the same issue. |
@darrachequesne could you share some info on the best way to gather the internal state of the client when this happens? The inability to establish a socket.io connection from the typescript client to the python server does happen in about 10% of the cases for me, so I should be able to catch it after a few retries. |
I'm seeing a similar issue that may be related. When I am connected with a mobile client and put the phone into airplane mode and back out again, about 1 in 10 times the connection does not seem to reconnect, and further messages are ignored. But what I found when logging was that the server most of the time does disconnect / connect but sometimes does connect / disconnect. In that second scenario, it needs a page reload to recover OR another switch to airplane mode and back off again. The client side shows that it recovered correctly and is sitting waiting for messages from the server. But the server believes it's disconnected so no longer sends to it. I connected the admin.socket.io and took the following screenshots, the first is a normal reconnection, the second is an abnormal reconnection. |
Hi, I'm using Socket.IO in a Node.js project, and sometimes the socket connection just stops working. The only way to get it working again is by refreshing the browser page.
I'm using namespaces to separate tenants, and Redis to manage socket IDs. Here is my frontend and backend configuration:
Frontend (Client-side):
Backend (Server-side - AdonisJS):
There are no errors in the console or server logs, and this issue happens randomly.
Has anyone experienced something similar? Could this be related to the Redis adapter or the namespace handling? Any suggestions on debugging or fixing this issue?
Thanks in advance!
The text was updated successfully, but these errors were encountered: