socketio / socketio/socket.io

Websocket Connection Becomes Unstable - Starts disconnecting and reconnecting after a while of being active

Open
#5,124 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation package:socket.io-client
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Description
I am using a Python based Websocket server version 5.4.1 and a React JS based Websocket client version 4.3.2.
My application is connecting to 10 Websocket servers from 1 client.
For some of my clients, after a random duration of time, the websocket connection starts to become unstable, disconnect and then reconnect nonstop.

To Reproduce
It doesn't reproduce by doing a certain action.
Even when there is a network disconnection we manage to reconnect without a problem and maintain a stable connection.
But it still seems like in certain situations, when the network speed is slow, and it experienced a disconnection of some sort, this happens. Although it doesn't happen every time.
I am struggling with solving it, and figuring out exactly when and why it happens.

Socket.IO server version: 5.4.1
Socket.IO client version: 4.3.2

Server

import flask
from flask_socketio import SocketIO

app = flask.Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*", ping_timeout=1200, ping_interval=1205, logger=False, engineio_logger=False)

Client

import {io} from "socket.io-client";

io( `${ep}/${namespace}`, { 'transports': ["websocket"], } )

Platform:
Happens on both Android and IOS devices.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the Flask-SocketIO server configuration and socket.io-client initialization shown in the issue, then test the connection under slow-network and intermittent-disconnection conditions. Done means the trigger is isolated and a reproducible failure or required configuration change is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, javascript, python, react
Domain
backend, frontend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.