Multiple subscrib to same scrip

vcb
Hello,

Currently, when it is needed to reconnect to websocket, i am sending a "unsubscribe" to all the scrips subscribed previously and then sending the "subscribe" to the websocket.

Wondering if "first unsubscribe then subscribe" is the right thing to do ?
  • rakeshr
    when it is needed to reconnect to websocket
    Didn't get you? All websocket connections are flushed at the end of the day. You need to generate a new access token for the next day.
  • vcb
    Didn't get you?
    Ok, this situation happens sometimes within the course for the day. If internet conection from one provider goes down, connection is switched to another internet provider.
  • rakeshr
    situation happens sometimes within the course for the day
    Yes, for within the active websocket session, the above flow seems fine.
  • vcb
    Ok, so, if the websocket is "close"d without "unsubscrib"ing and connected again after a few seconds (through another internet provider), and again a "subscribe" is sent, would the same scrips be subscribed twice ? Would the same quote for the same scrips be transmitted twice ?
  • rakeshr
    if the websocket is "close"d without "unsubscrib"ing and connected again after a few seconds (through another internet provider),
    Once the underlying network changes, mostly the current websocket connection will be closed. And would require a fresh subscription.
    again a "subscribe" is sent, would the same scrips be subscribed twice ? Would the same quote for the same scrips be transmitted twice ?
    No, transmission instrument_tokens will always be unique, even if you send duplicate subscription items.
Sign In or Register to comment.