socket.io: transport close - ping has not timeout

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • report a bug
  • request a feature

Current behaviour

socket.io will occur “transport close” when i use the internet proxy software. I want to know the root cause, so open DEBUG model on client and server sides, still no answer after check the log.

remark : the option of client reconnect is closed.

I guessed that:

  1. The part of data packets are lossing
  2. Heartbeat is timeout(i have tried increase the timeout of by the options “pingTimeout” and “pingInterval”, but it seems that the effect is not obvious)

server log: Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket got packet {"type":2,"nsp":"/","data":["message",{"message_id":"msg_sync_mouse_1520330439192","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":402,"y":-13,"cursor":"default"}}]} Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket emitting event ["message",{"message_id":"msg_sync_mouse_1520330439192","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":402,"y":-13,"cursor":"default"}}] Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket dispatching an event ["message",{"message_id":"msg_sync_mouse_1520330439192","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":402,"y":-13,"cursor":"default"}}] Tue, 06 Mar 2018 10:00:39 GMT socket.io:client client close with reason transport close Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket closing socket - reason transport close Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket leave room 5a72ba31f329910992b98de0 Tue, 06 Mar 2018 10:00:39 GMT socket.io:socket left room 5a72ba31f329910992b98de0

client log: browser.js:133 engine.io-client:socket flushing 1 packets in socket +15ms 18:00:39.425 browser.js:123 socket.io-client:manager writing packet {"type":2,"data":["message",{"message_id":"msg_sync_mouse_1520330439426","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":439,"y":62,"cursor":"default"}}],"options":{"compress":true},"nsp":"/"} +18ms 18:00:39.425 browser.js:133 socket.io-parser encoding packet {"type":2,"data":["message",{"message_id":"msg_sync_mouse_1520330439426","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":439,"y":62,"cursor":"default"}}],"options":{"compress":true},"nsp":"/"} +17ms 18:00:39.426 browser.js:133 socket.io-parser encoded {"type":2,"data":["message",{"message_id":"msg_sync_mouse_1520330439426","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":439,"y":62,"cursor":"default"}}],"options":{"compress":true},"nsp":"/"} as 2["message",{"message_id":"msg_sync_mouse_1520330439426","client_id":"p-VZ_JZeeBABWZwYAAAB","type":"sync_mouse","initiator":"5a379898f329915fd2470d72","data":{"user_id":"5a379898f329915fd2470d72","meeting_id":"5a72ba31f329910992b98de0","x":439,"y":62,"cursor":"default"}}] +0ms 18:00:39.426 browser.js:133 engine.io-client:socket flushing 1 packets in socket +17ms 18:00:39.429 browser.js:133 engine.io-client:socket socket close with reason: "transport close" +3ms 18:00:39.429 browser.js:123 socket.io-client:manager onclose +4ms 18:00:39.430 browser.js:123 socket.io-client:manager cleanup +0ms 18:00:39.430 browser.js:123 socket.io-client:socket close (transport close) +1ms

Steps to reproduce (if the current behaviour is a bug)

Note: the best way to get a quick answer is to provide a failing test case, by forking the following fiddle for example.

Expected behaviour

to find out the reason, avoid “transport close”

Setup

  • OS:mac ox
  • browser:chorme
  • socket.io version:2.0.4

Other information (e.g. stacktraces, related issues, suggestions how to fix)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I second @vinaymuley96 Socket.io 2.3.0 would throw transport error after a few seconds of inactivity on React-native Android (with the app closed and the socket being inside a headless script). Downgrading to 2.0.3 seems to have fixed this.

Is still happening

Still facing issue on “socket.io”: “2.3.0” “socket.io-client”:“2.3.0”

Client randomly disconnects with reason transport close and reason on server is ping timeout. disconnect event is triggered only when client is receiving data continuously. I have tried changing ping interval and ping timeout on both client and server.

The socket is stable and ping/pong events are triggered as expected.

I didn’t faced any issues on both client and server on version 2.0.3. I have tried degrading the version to 2.0.3 and everything worked without any disconnect event

@vinaymuley96 @Unforgiven-wanda The same problem, downgrading from 2.3.0 to 2.0.3 seems to have fixed this, thanks guys, you saved my time 👍

still facing same issue on “socket.io”: “2.2.0”, “socket.io-client”: “2.2.0”,

image socket.io-client:socket close (ping timeout) +22s