It looks like you're new here. If you want to get involved, click one of these buttons!
ticker.unsubscribe(parseInt(requiredTokenToBeRemoved)); // where requiredTokenToBeRemoved is the value to be removed from the items array
ticker.setMode(ticker.modeLTP, items); // where items has been defined initially and returning ticks continuously
ticker.disconnect();
ticker.connect();
ticker.on("connect", subscribe);
ticker.on("ticks", onTicks);
but the above code does not work and my initial list of subscribed tokens ticks are only getting returned. Please advice.
Rest of the code is not necessary.
@tonystark , @sujith , @rakeshr - can you please share any example code where unsubscribe is being used in a different function call rather than in the same function.
Thanks so much! This is the final step in my application and the only issue pending.
From the examples given there, I can infer that unsubscribe is called within on_ticks but won't that check happen every time a tick is received? I want to unsubscribe only after user input and don't need that check every time ticks are received. Can you please suggest how to do that?
Any help on this please?
We can't provide much help without knowing what exactly is the logic. From your description "I want to unsubscribe only after user input" this seems to be very straightforward, simply calling "ticker.unsubscribe" after user input/submit should do what you are looking for. There are no other restrictions like call from same function or on_tick to unsubscribe. You can call that from anywhere.