Socket connection disconnected with error message - unexpected server response (403)

enliyo
Hi,

I log in to my NodeJS app everyday around 7-8 AM. Everything was working smoothly until around 12:10 PM that is when websocket started receiving error unexpected server response (403) and out of 3 websocket connections only one was receiving ticks.

Looking back, I had logged in to Kite Web app around that time to check positions. It was mentioned somewhere that simultaneous logins are not allowed but Connect apps will keep working as before. Clearly this was not the case as after login to Kite app, one of important websocket was treated as if its token had expired. In spite of that, normal Kite API calls and other websocket was working as expected.

What was this glitch? Why was only one websocket received 403 while others kept working? There is no code change related to websocket connections from my backend so I confident that this issue is from Kite Connect side.
Tagged:
  • sujith
    When the session is expired, Kite Ticker won't kill the existing connection. Your app will continue to receive ticks.
    Kite Ticker will not allow creating a new connection or it will not allow re-connection when there is a drop, in case the session is already expired.

    You can check out this thread to know more about the multiple simultaneous sessions restriction.
  • enliyo
    enliyo edited March 19
    @sujith thanks for quick reply. That clarifies why existing connections kept working.

    From linked thread,
    At the same time, only one session will be valid.
    This will not affect Kite Connect apps.
    When I was logged into Kite, it should have killed my other sessions e.g. web and mobile. NodeJS Connect should remain active, right? But that is not exactly what happened in my case.

    Connect session was active because I was able to fire APIs using connect.js library but only one websocket connection was expired. That doesn't make sense to me. Either complete session should have expired or none of it. My case seems to be partial websocket token expiration.
  • sujith
    A Kite connect login uses the kite web login.
    You need to log in to Kite Connect and then log in on the Kite web. The other way around will kill the Kite Connect session. In this case, you logged into Kite web second time.

    PS: The Kite web and Kite Mobile sessions are independent. Multiple Kite web logins are not allowed.
Sign In or Register to comment.