Skip to content

Socket.io client keeps disconnecting and reconnecting at a fixed interval because of ping timeout #5117

Open
@valentin-at-edlio

Description

@valentin-at-edlio

Recently I've updated my socket.io server and client to 4.6.1 and ever since then my client keeps disconnectiong and reconnecting at a fixed interval. The disconnection reason on the client is ping timeout...

It does not matter whether the tab is in the foreground or background.
I cannot reproduce this issue on localhost.

I still have a client that uses 2.2.0 and it does not reconnect at all and seems to be working correctly.

Left is 2.2.0, right is 4.6.1. They both connect to the same server.
Screenshot_601

And more importantly the 4.6.1 client receives the ping (2) and sends the pong (3) message to the server, but it does not seem to matter.
image

Socket.IO server version: 4.6.1

Server

    this.io = new Server(httpServer, {
      allowEIO3: true,
      serveClient: false
    });

Socket.IO client version: 4.6.1

Client

    this.socket = io(url, {
      transports: ['websocket'],
      reconnection: true,
      reconnectionAttempts: 50,
      reconnectionDelay: 5000,
      reconnectionDelayMax: 25000,
      auth: {
        token: *****
      }
    });

Expected behavior
I expect the 4.6.1 client not to reconnect at a fixed interval.

Platform:
I can reproduce with:

  • Chrome Version 113.0.5672.127 (Official Build) (64-bit)
  • Firefox 113.0.1 (64-bit)
  • Microsoft Edge Version 113.0.1774.50 (Official build) (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions