Unable to Get LTP Using Websocket Java kit

ER9842
ER9842 edited May 2021 in Java client
Hi
I am using kite connect 3 dependencies, here I am trying to subscribe instrument tokens, but unable to subscribe instrument token, using below java code

KiteTicker tickerProvider = new KiteTicker(tradeCredentials.getAccesstoken(), tradeCredentials.getApikey());
tickerProvider.setTryReconnection(true);
//maximum retries and should be greater than 0
tickerProvider.setMaximumRetries(50);
//set maximum retry interval in seconds
tickerProvider.setMaximumRetryInterval(30);
tickerProvider.subscribe(instrumentTokens);
tickerProvider.setMode(instrumentTokens, KiteTicker.modeLTP);
tickerProvider.connect();
After Connect method called I checked the token subscribe status it showing 0 sizes. is anyone know what issue is here. First, this is started as random. nowadays it always happening.

as you can see below image subscribe tokens cound size 0. but i subscribed. before calling connect.

  • sujith
    You need to connect and then send the subscribe message.
    The onTick callback with 0 ticks length is because Kite Ticker sends heartbeat tick every second. If there is data then length will be greater than 0
  • ER9842
    ER9842 edited May 2021
    can u please share an example @sujith , here subscribe token itself unable to register, above image you can see, subscribetokens
  • sujith
    You can check out javakiteconnect repo for example.
Sign In or Register to comment.