It looks like you're new here. If you want to get involved, click one of these buttons!
subscribe(instruments, onTicks) {
const _kt = this.kt = new KiteTicker({
api_key: 'xxx',
access_token: 'xxx'
})
_kt.connect()
console.log( _kt.connected() ) // gives me false
_kt.on('ticks', onTicks)
_kt.on('connect', () => {
_kt.subscribe(instruments)
_kt.setMode(_kt.modeFull, instruments)
}
}
I have checked the api_key and the access_token to be correct. So I opened the /node_modules/../ticker.js file in /node_modules to figure out what is the problem. To my surprise there is no error checking in the connect() function. If the connection is open connect() simply returns (without even a true/false).
We tried exact same code as above at our end, after rectifying few syntax error and it's working fine. Response:
Thank you Rakesh, for the effort taken to go through my code. The error was in my array of instrument. It contained strings [ "9594882", ...] instead of integers [ 9594882, ...].
Having said that, I would still want exceptions to be thrown (or promises to fail for asynchronous code) by the API when it detects an error. The KiteTicker methods should not fail silently. I hope we agree on this.