socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Allow disabling ping/pong?

Open STRML opened this issue 10 years ago • 9 comments

It would be nice if a 0 value for pingInterval or pingTimeout could disable ping/pong checking entirely.

When used with an abstraction layer like Primus, the ping/pong is redundant and can sometimes cause situations where engine.io terminates the connection and Primus doesn't pick up on it. In those cases Primus might not reconnect.

STRML avatar Mar 05 '15 07:03 STRML

@STRML if Primus doesn't pick up those connection terminations it's a bug in Primus so please report that in https://github.com/primus/primus as for the disabling of ping/pong's. I would love to see that as well.

3rd-Eden avatar Mar 06 '15 22:03 3rd-Eden

Closed due to inactivity, please reopen if needed.

darrachequesne avatar Oct 24 '16 23:10 darrachequesne

Maybe it makes sense to reopen as this was a feature request which I also support.

lpinca avatar Jan 22 '17 14:01 lpinca

PR is welcome!

darrachequesne avatar Jan 22 '17 20:01 darrachequesne

@darrachequesne thanks. If I'm not wrong Engine.IO sends ping messages from client to server. We are currently doing the same in Primus but just FYI we are considering reversing the direction of pings and make the server send them to the client as browsers started to throttle timers. See https://github.com/primus/primus/issues/348 if you are interested.

lpinca avatar Jan 22 '17 20:01 lpinca

@lpinca You're right, pings are sent by the client. But a timer is set on both the client and the server (allowing to detect any unavailability from the other side), isn't that the case with primus?

darrachequesne avatar Jan 22 '17 21:01 darrachequesne

Yes, but the client timer that sends the ping is delayed by the browser so the server incorrectly closes the connection. Imagine that you used setTimeout(sendPing, 20000); on the client. The sendPing callback is not actually called after 20 sec but after 40 sec.

Hope it makes sense :)

lpinca avatar Jan 22 '17 21:01 lpinca

This is something we'll have to be prepared for in every browser - Safari has been doing this for years, Chrome is next and I'm sure FF and IE are not far behind. We simply can't rely on client timers being anywhere near reliable. I've seen 130+ (!) delays in Chrome 56. Word from them is that they will set a max, but the writing is on the wall.

On Jan 22, 2017 3:28 PM, "Luigi Pinca" [email protected] wrote:

Yes, but the client timer that sends the ping is delayed by the browser so the server incorrectly closes the connection. Imagine that you used setTimeout(sendPing, 20000); on the client. The sendPing callback is not actually called after 20 sec but after 40 sec.

Hope it makes sense :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io/issues/5082, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJFP9A_SydFX0hUCYKgTSZY1IZojB5Uks5rU8npgaJpZM4Dp2fJ .

STRML avatar Jan 22 '17 23:01 STRML

Following up on this issue, as of commit 31ff875 it has reversed the ping-pong mechanism. So, is this issue still relevant?

haneenmahd avatar Apr 30 '23 03:04 haneenmahd