KiteTicker functions are empty at v5.0.0

___Balajee___
Hi, i was using kiteconnect:4.1.0 and yesterday i update to kiteconnect:5.0.0 and after that disconnect() is not working along with few more logic.

After debugging i thought to rollback and noticed that few functions are not available at 5.0.0 compare to v4.1.0

v4.1.0:

KiteTicker {
modeFull: 'full',
modeQuote: 'quote',
modeLTP: 'ltp',
autoReconnect: [Function (anonymous)],
connect: [Function (anonymous)],
disconnect: [Function (anonymous)],
connected: [Function (anonymous)],
on: [Function (anonymous)],
subscribe: [Function (anonymous)],
unsubscribe: [Function (anonymous)],
setMode: [Function (anonymous)],
parseBinary: [Function (anonymous)]
}


v5.0.0

KiteTicker {
root: 'wss://ws.kite.trade/',
api_key: '*************',
access_token: '******************',
modeFull: 'full',
modeQuote: 'quote',
modeLTP: 'ltp'
}


is this expected?
Tagged:
  • Dileep
    Dileep edited August 23
    Hi @___Balajee___ Can you share the link to get the V4.1.0 kite ticker details? i too faced similar type of issue https://kite.trade/forum/discussion/14320/time-lag-between-exchange-time-and-system-time-from-v5-relese#latest
  • ___Balajee___
    not sure what link you are referring. I just degrade "kiteconnect": "^4.1.0", at my package.json and did npm install once again.
  • Dileep
    v4.1.0:

    KiteTicker {
    modeFull: 'full',
    modeQuote: 'quote',
    modeLTP: 'ltp',
    autoReconnect: [Function (anonymous)],
    connect: [Function (anonymous)],
    disconnect: [Function (anonymous)],
    connected: [Function (anonymous)],
    on: [Function (anonymous)],
    subscribe: [Function (anonymous)],
    unsubscribe: [Function (anonymous)],
    setMode: [Function (anonymous)],
    parseBinary: [Function (anonymous)]
    }

    where did you get this code?
  • rakeshr
    @___Balajee___
    v5.0.0
    KiteTicker {
    root: 'wss://ws.kite.trade/',
    api_key: '*************',
    access_token: '******************',
    modeFull: 'full',
    modeQuote: 'quote',
    modeLTP: 'ltp'
    }
    Actually, you are just printing the constructor response. Which has these fields, as you can see in the lib.
    To get all the properties of class in typescript, you can print something like
    console.log(Object.getOwnPropertyNames(Object.getPrototypeOf(ticker)));
    Sample response:
    [
    'constructor',
    'autoReconnect',
    'connect',
    'attemptReconnection',
    'triggerDisconnect',
    'connected',
    'on',
    'subscribe',
    'unsubscribe',
    'setMode',
    'parseBinary'
    ]
    disconnect() is not working along with few more logic
    triggerDisconnect is working fine for me. Can you let me know, what exactly are you facing error? Is reconnect failing?
  • ___Balajee___
    ___Balajee___ edited August 23
    so does it mean that .disconnect() has been changed to triggerDisconnect()

    Let me ask differently.

    i have my instance created as below

    tickInstance = await new KiteTicker({
    api_key: this.zerodhaApiKey,
    access_token: this.zerodhaAccessToken,
    });
    tickInstance.connect();

    and i have my logic which will watch the trade and at 3:25pm i want to stop everything... so i used something like this

    if (tickInstance) tickInstance.disconnect();


    The above logic works fine with v4.1.0 but it says .disconnect() is not a function if i use v5.0.0.

    the code which i shared in my first thread is console.log(tickInstance) before calling .disconnect()
  • rakeshr
    so does it mean that .disconnect() has been changed to triggerDisconnect()
    No, it's an internal callback for disconnect event. It's used at onclose and connect.
    tickInstance.disconnect()
    Okay, so you are looking for a callable method to disconnect forcefully. Looks like it was missed in v5. I have added now and made a new release v5.0.1. Should be fine now.
This discussion has been closed.