Describe the bug
When using socket.io in an Angular project with Server Side Rendering enabled, the socket disconnects after 70 seconds (with default pingTimeout and pingInterval values).
Setting lower pingTimeout and pingInterval values will trigger the disconnects after a shorter time period.
This issue does not occur on socket.io version 4.3.2, but it does occur in version 4.4.0 and above.
To Reproduce
- Clone the Minimal Reproducible Example
- Run npm install to install the dependencies.
- Run
npm run build:dev to build the project in development mode.
- Run
npm run serve:ssr:dev to serve the project in development mode.
- Navigate to http://localhost:3000/ and open the developers console.
- Observe that "Socket disconnected after X seconds. Reason: ping timeout" is logged every
pingTimeout + (pingInterval * 2)
Expected behavior
The socket should stay connected continuously.
Platform:
- Device: macOS (but I believe this doesn't matter).
- OS: macOS Sonoma 14.5 (but I believe this doesn't matter).
Additional context
- If instead of the latest socket.io version (4.7.5) I install socket.io version 4.3.2 this issue doesn't occur. The socket stays connected as expected.
- The issue does occur in socket.io versions 4.4.0 and above.
- If I connect to a different socket.io server, which isn't part of the Angular SSR project, the issue doesn't occur.
Describe the bug
When using socket.io in an Angular project with Server Side Rendering enabled, the socket disconnects after 70 seconds (with default pingTimeout and pingInterval values).
Setting lower pingTimeout and pingInterval values will trigger the disconnects after a shorter time period.
This issue does not occur on socket.io version 4.3.2, but it does occur in version 4.4.0 and above.
To Reproduce
npm run build:devto build the project in development mode.npm run serve:ssr:devto serve the project in development mode.pingTimeout + (pingInterval * 2)Expected behavior
The socket should stay connected continuously.
Platform:
Additional context