intermittent websocket disconnection

trk0653
Hi Team,

I've been facing intermittent websocket disconnection issues multiple times today, the last one being at 02:17 PM. Also, I've observed that the Web socket gets disconnected when the system enters sleep mode. Could someone please guide me on this, so that I can proceed further. Attached are the screenshots of the error I'm getting for your reference.



Any help is really appreciated. Thanks a lot in advance
  • rakeshr
    Go through python WebSocket client FAQs here.
  • trk0653
    As mentioned in the above FAQs , i implemented my entire parsing & calculation part with in while true inside helper method , but still im facing same issue.Could u please give some overview on it
  • vcb
    Same problems here since 14th Dec 2021 !

    Sample "OnError" log:
    15:17:57 > TickerReStart > Ticker Error: new ClientWebSocket AggregateException > Error while connecting. Message: Unable to connect to the remote server
    15:17:57 > TickerReStartOnError > Restarting Ticker
    15:17:57 > TickerReStart > Ticker Error: new ClientWebSocket AggregateException > Error while connecting. Message: Unable to connect to the remote server
    15:17:57 > TickerReStartOnError > Restarting Ticker
    15:17:57 > TickerReStart > Ticker Error: new ClientWebSocket AggregateException > Error while connecting. Message: Unable to connect to the remote server
    15:17:57 > TickerReStartOnError > Restarting Ticker
    15:17:57 > TickerReStart > Ticker Error: new ClientWebSocket AggregateException > Error while connecting. Message: Unable to connect to the remote server
    15:17:57 > TickerReStartOnError > Restarting Ticker
    15:17:57 > Ticker Connected
    15:17:57 > Ticker Tokens > Subscribed to 99 equity and 6 commodity tokens
    15:17:57 > TickerReStart > Ticker Error: Retry attempt 1
    15:17:57 > TickerReStartOnError > Restarting Ticker
    15:17:58 > TickerReStartOnError > OnReconnect: 15 times
    15:17:58 > TickerReStartOnError > OnReconnect: 15 times
    Websocket was working fine till 13 Dec 2021. Problem with wss://ws.kite.trade ?
  • rakeshr
    Message: Unable to connect to the remote server
    Looks like a local network proxy issue. Can you check on your network?
    Problem with wss://ws.kite.trade?
    No, it's working fine at our end. All API users including our front-end application use the same WebSocket connection.
  • vcb
    @rakeshr, thanks for the replies, and the status of "wss://ws.kite.trade" at your end ! Guess i need to delve deeper in my laptop system.
  • Gjain75
    I could also figure out, if the processes inside while loop, on secondary thread where Ticks are processed, takes longer than the interval of Tick data received, then it causes connection to close and reconnect after the 'secondary process' is complete.

    For e.g. saving a huge dataframe to disk takes more time than the tick time i.e. 0.25 seconds, if you remove this, the socket never breaks.

    just posting if it helps anyone else, though am novice on this.
Sign In or Register to comment.