I'm trying to disconnect from a web socket connection using disconnect() and then trying to create new connection after 5 minutes. But instead of disconnecting, 2 connections are created then 3 then 4 and so on.
Also tried using triggerDisconnect() which is showing an error that triggerDisconnect() is not a function.
What I'm trying to achieve is to receive data for multiple stocks with a single call to kite connect with an interval of 5 minutes. Any best practice?
Hi @Sowmay, triggerDisconnect() is an internal function used by kiteconnectjs. You need to use websocket object to disconnect. Websocket object name is ws.
kiteconnectjs reconnects upon disconnection.
Did you try setting autoReconnect(false) and try?
What about "triggerDisconnect() is not a function"? What's the work of triggerDisconnect()?
triggerDisconnect() is an internal function used by kiteconnectjs. You need to use websocket object to disconnect. Websocket object name is ws.
I set autoReconnect(false) but still, the existing connection is not disconnecting.
ticker.autoReconnect(false)
function setTick(ticks) {
console.log("ticks received")
ticker.disconnect()
}
First time single "ticks received" logged out then twice, then thrice and so on. Existing connections are not aborted.
Any correction above?
Can you log inside onclose callback and check?