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
Continual “transport close” on client #3025
Comments
Updated to socket.io v2.0.3. and still having the problem. It only seems to happen on one of my PCs. I also disabled the windows firewall, but the problem is still happening. |
Switched to ws (https://github.com/websockets/ws) which involved massive rewrites, but i now use the native websocket browser object on the client side and everything works perfectly. I no longer have the problem. So long socket.io! |
Experiencing the same thing. I really don't want to have to go through a rewrite. Any one have any success with this issue? |
I was really tired of this problem. I recommend simply using CDN like below for client. <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.slim.js"></script>@ref: https://cdnjs.com/libraries/socket.io I hope it helps. |
Feudal Wars dev?? It`s great. |
Any news on this problem, cuz i have the exact same problem! |
I have the same issue as well when I deploy to k8ns but when I run locally it works fine. |
I'm also suffering from this... |
@talas9 @muhammadnasr @htamop the common questions to be able to debug / reproduce the issue:
Thanks! |
I have tried it with 2.1.0 and 2.0.4 client and server. On chrome and safari (latest). FYI connection is closed exactly after 25 seconds every time, see screen shot |
@talas9 @htamop @dnwldbs84 are you using a load balancer? |
@darrachequesne Which load balancer(s) do you recommend using with socket.io ? |
@muhammadnasr @darrachequesne |
I had not used a load balancer. Both the client and server used the 2.0.3 version of Socket.io (I can't remember all version I used). I do not know which browser is causing the problem However, most users have used Chrome. In my case, the disconnect was randomely so it can't reproduce. |
@muhammadnasr @darrachequesne @dnwldbs84 |
10 millseconds is too narrow, this way the network will be overwhelmed. |
Correct! @muhammadnasr any load-balancer should work. Please see the following examples:
Sticky-session is required though, if you enable polling (which is the default). |
@darrachequesne I have the same issue, after like 8~9 hours the socket disconnects with the reason of "transport close" I'm using:
|
Had a same issue, was able to fix it using CDN from this comment #3025 (comment) and setting timeout and interval like below:
|
Hey, |
First of all really thanks for this awesome project. Same issue here, maybe I'll bring your something new. I have a ws server, and a ws client on node js. Other ws clients from web browsers (from client apps) are communicating through the ws server with this node js service. Everything is working as expected. On stress tests now (10 clients are asking intensively data), at the end of the tests, when all the jobs and transactions have been finished the connection of the service is closed with error "transport close". This is not happening always. This is the config of the server: Also, with the default config pingTimeout: 2000, I was getting this error in the middle of the stress test. This also was completely unexpected, but let's say that the server was overloaded and couldn't respond within 2secs(!) and we might get this error. But now with pingTimeout: 15000 it happens almost 50% and only after the end of the tests. Hmho, I believe the micro-services should expected this kind of errors, even if they are running on the same lan, but the question is why is this happening? I tried to create a small setup to reproduce this problem but I couldn't make it. How to activate the logs? the DEBUG=socket.io* is not working. Although the variable is set, I don't get any output. |
I strongly believe that this is related to #2924. |
@muhammadnasr where you able to get past the deploy issue on K8s? I am experiencing similar issues. |
@bheema01 just make sure you have stickysession enabled on your proxy/loadbalancer and it should work |
Got same error |
Same issue .....clients connect and disconnect repeatedly when server side socket endpoint is behind a load balancer. Even after configuring sticky sessions , issue still exists . @muhammadnasr were u able to resolve the issue. |
I have seen this error, when the thread was blocked frequently for more than 200ms. |
@varunSabnis after fixing sticky session, everything worked smoothly. |
@dennisat I tried checking how long it took for my client to receive a pong packet. Every time it was beyond 200ms, which was tested both with socket server in the cloud and socket server on my localhost. The local setup doesn't disconnect the socket(everything works fine) , whereas in the cloud setup socket continually connects and disconnects. So , i don't think that's the issue. |
I encountered the problem of socket.io disconnection every 30 seconds after deploying to Google Cloud Platform (GCP). It turned out to be a default http timeout used by the Global Load Balancer. The GCP documentation said you should change the value when using websockets. Instructions for changing the setting are here: |
Same here. The local server never gets a problem. But when deploying behind a load balancer, it has ping timeout randomly. Probably 1 in 50 times. I have tried to use the CDN version and adding the sticky session. The problem still exists. |
Nothing worked for me besides some custom reconnect logic. If the client gets a socket open event with a different id than the previous one, send the server a reconnect event with the old & new id. Then on the server just update the socket id of the player and resend the game state. |
@tmusaev could you post that custom reconnect logic for the client? |
I have the same issue: 'transport close' |
have the same problem. finally I resolve it. Nginx is my proxy server , but the solution:
|
I've used this library for chatting and to get some events. It works fine in ios but creates an issue in android. It lost socket connection anytime and re-connect. It continuously display same behavior. and also give this transport close or ping timeout error |
+1 |
In our case, the issue is caused by CDN proxy. I solved this problem by connecting socket.io to the original site that was not CDN proxied. |
We tackled this problem by updating the nginx ingress controller! |
For those that are using Socket.IO to send large amounts of data, make sure to do it in a manner that doesn't block the thread. I encountered this today using the socket client on React Native and I'm using it to send files to the server. Because of how we wrote the sending of files through the socket, which is essentially all-in-one-go instead of sequentially, the JS thread gets choked and can't send a pong back to the server, disconnecting it, giving us this error. |
I have same issue on my app, I don't think is ping pong issue. I doubt it should be issue cause by server side which closed the transport of socket. |
After my analysis, I found the below issue ISSUE: I saw this issue only when running the node application using an upstart service or systemmd service, if we run the application like node app.js, I am NOT seeing this issue. SIMPLE FIX/WORKAROUND:
With the above scenario, all the users are always connected and online, will be disconnected when loggedout |
It works ! |
I'm going to close this issue, because there seems a lot of different problems thrown here.
In any case, please note that this is not possible. There is a lot of things that can break a TCP connection (and thus a WebSocket connection), your application shouldn't rely on a always-healthy connection. |
Today i was suddenly facing this issue on production when i debug this error root cause was that there was an exception in code and was reseting all my socket connection |
I my case, this was the problem: https://socket.io/docs/v4/troubleshooting-connection-issues/#you-are-trying-to-send-a-huge-payload |
i try to upgrade node version to > 10.0.0 is working for me |
I was using the socket-io client package for flutter and made a mistake of assigning a string to the auth parameter of the socket instance I changed it to an object and it worked.
|
For anyone still facing this issue after trying all the solutions in this thread, in my case the issue was with the new version of Next.js (>13.2.4) installed on my environment. You can read more on the issue and the solutions in this thread: vercel/next.js#49334 If that's not the case for you and you still have this issue, the 3 most possible explanations for a disconnection are: The browser tab was minimized and heartbeat has failed Hope this helps anyone out there ❤️ |
Thanks! you save my life! |
@nodecook-dev I've added a note about For future readers: Please check our troubleshooting guide: https://socket.io/docs/v4/troubleshooting-connection-issues/ |
in nginx config file
but when I use domian some times is disconnect :transport close |
I've setup socket.io v.1.4.5 w express and I have been unable to trace the reason for unexplainable disconnects on the clients. The reason given by the disconnect event on the client is "transport close." It happens very consistently on some clients.
Is there any explanation for a client getting "transport close" disconnects on what seems to be a timed interval? The client reconnects just fine but it causes extreme inconvenience because it happens so frequently.
I've tried various settings, like changing the pingInterval, pingTimeout and the port for websockets (I am now using port 80). But no matter what I seem to do, the problem never goes away.
The text was updated successfully, but these errors were encountered: