Websocket Connection Issue | Oct 6 2022

nselvamca
Hi @sujith ,

Am getting HandShake issue for the Java WebSocket Connection, the connection was fine till yesterday. Please let me know is there any open issue for the same

Error:
com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.1 429 Too Many Requests

Hi Any one facing the similar issue?

Thanks,
Selva
Tagged:
  • sujith
    @nselvamca,
    It seems like you have exceeded the rate limits. One can open up to 3 websocket connections per api_key.
  • nselvamca
    @sujith ,
    Nop its only one connection am using, hope there is no issues with Websocket Today right?
  • nselvamca
    @sujith ,
    On the first attempt its getting failed,

    Log:
    [2022-10-06T15:59:02.002Z] [com.Examples] [main] [992] [INFO ] START tickerUsage ============>
    com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.1 429 Too Many Requests
    at com.neovisionaries.ws.client.HandshakeReader.validateStatusLine(HandshakeReader.java:232)
    at com.neovisionaries.ws.client.HandshakeReader.readHandshake(HandshakeReader.java:54)
    at com.neovisionaries.ws.client.WebSocket.readHandshake(WebSocket.java:3244)
    at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3123)
    at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2155)
    at com.zerodhatech.ticker.KiteTicker.connect(KiteTicker.java:216)
  • dknaix
    today (6-OCT-22) even i got dropping WS connection, with 2 WS connection from 1 api key, what can be the issue? python code was running on AWS Cloud, though it reconnects after 2s this happened in morning a few times around 9.30am .I am using pykiteconnect python lib
  • sujith
    @nselvamca,
    It could be because you haven't closed connection properly. Server might have an ongoing connection and your program might have dropped it. You need to call close method so that connection can be closed gracefully.

    @dknaix,
    Are you sure you are not blocking the main thread that receives ticks?
  • nselvamca
    @sujith ,
    Thanks for your awesome support, there was one more instance running in another server that is root cause of this issue.

    Please close this thread.

    Thanks a ton
  • dknaix
    @sujith i am using multi-threading, also using kiteTicker in threading mode, the main thread dies after initiating the kite ticker and the callbacks keeps firing, so i use the in-memory DB to store the ticks, and fetch data from there. And using other child threads born from main thread to perform api calls. The disconnection happens at random time sometimes 15mins interval or 2mins etc. but it takes 3-4 secs to reconnect. i cannot understand the reason for this, since i am working with options 3-4 seconds are valuable to me as volatility is high in BN please help
  • rakeshr
    the main thread dies after initiating the kite ticker
    If you are using the ticker in threaded mode, you need to keep the main thread active to keep the daemon threads running. This explains in depth.
    Can you paste here the complete disconnection log? There would be reason in the error message, if you are using an on_close callback.
  • dknaix
    Error : "Connection closed: 1006 - connection was closed uncleanly (WebSocket opening handshake timeout (peer did not finish the opening handshake in time)" , today this didn't happened even once okay will try different approach. As we all know its more scary when a bug just disappears, it will haunt you in your dreams and someday it will come back again with element of surprise :D
Sign In or Register to comment.