ping pong in socket io version 4.4.1 not work Automatically

595 Views Asked by At

the server send ping to client only once and the client responds but after that the server doesn't ping again causing timeout and disconnection

the server option is { path: "/socket/events", transports: ["websocket], allowUpgrades: false, pingInterval: 10000, pingTimeout: 25000 }

the client option is { auth: {token: accessToken}, transports: ['websocket'], path: "/socket/events", upgrade: false, autoConnect:true }

1

There are 1 best solutions below

0
On

Do not set allowUpgrades: false in your server options. By doing this you are disabling the connection to upgrade from polling to websocket. Also in your server and client options keep transports: ["polling","websocket"] to allow fallback to polling in case of websocket failure.