Recurring Websocket Disconnection

Dear Upstox Support Team,

I am writing to report a recurring issue with the Upstox Python API client library while running on a Windows system. The websocket connection constantly drops unexpectedly on a daily basis.

The following sequence of events and errors is observed:

The websocket connection drops.
The autoReconnectStopped event is emitted.
Upon API client cleanup, the following Windows-specific error is thrown: [WinError 6] The handle is invalid.

This happens repeatedly and disrupts my application’s connection to the websocket.

Other details:
Operating System: Windows 11
Upstox API Library Version: 2.18.0
Python Version: 3.10.4
UPSTOX User ID: 4JCB2J

How to resolve this issue?

Hi @Tanya_51107873
WebSockets can get disconnected for various reasons, so we have implemented an auto-reconnect feature that you can use:

Since you are receiving the autoReconnectStopped event, it indicates that the auto-reconnect functionality is disabled in your setup.
Please enable auto-reconnect and try again — once enabled, the WebSocket should automatically reconnect whenever a disconnection occurs.