ERROR: Exception on container connectToServer, re

sivannarayanagunji
I am getting ERROR: Exception on container connectToServer, reason: Handshake error when i am trying to connect to web socket.

I am using the URL as wss://ws.kite.trade?api_key=APIKEY&user_id=MYUSERID&access_token=ACCESSTOKEN

can someone please help me with this error ?

or if you have any phthon code , please share with me .. i really need to something to get the data

Thanks,
Siva.

  • rakeshr
    @sivannarayanagunji
    I am using the URL as wss://ws.kite.trade?api_key=APIKEY&user_id=MYUSERID&access_token=ACCESSTOKEN
    You don't need to send user_id param, you can check complete correct param here.
    if you have any python code, please share with me .. i really need to something to get the data
    You can check python client WebSocket code here.
  • sivannarayanagunji
    Can someone write simple code to read tick data from web socket ? i am not able to proceed further
  • rakeshr
    @sivannarayanagunji
    Can someone write simple code to read tick data from web socket ? i am not able to proceed further.
    Which kite connect client are you looking for?
  • sivannarayanagunji
    @rakeshr I am able to use java kite connect and it is working fine to place orders , but i need help to read websocket data using java.. i am not aware of python.. so please help me to read websocket data using java
  • sujith
    You can refer to the example here.
  • sivannarayanagunji
    @sujith i checked this and tested.. it is connecting fine.. but i am not getting any ticks.. is there anything wrong with websocket that it is not returning any tick data ?
  • sivannarayanagunji
    @sujith

    I have authenticated and I am able to get access token , then passing the kiteconnect object to the code which you have given..

    it looks like it is not connecting to kite ticker

    final KiteTicker tickerProvider = new KiteTicker(kiteConnect.getAccessToken(), kiteConnect.getApiKey());

    boolean isConnected = tickerProvider.isConnectionOpen();
    System.out.println(isConnected);
    --- for the above code, i am getting false which means ticket is not connected.

    no tick level information is displaced.

    can you please check once and let me know if anything is wrong ?

  • sujith
    It is a tested code and we use it in our production.

    You may also implement onError and put a log there as well.
  • sivannarayanagunji
    @sujith it looks the code I was using has some issue , bit I am able to read the data now using kiteconnect jar. It's working fine.


    But if internet is disconnected and reconnects back , I am getting zero ticks though retry count is set to 100.

    If I restart the program I am getting the data again, how can I get the data once it is reconnects without restarting the program again ?
  • sujith
    Can you let us know the version of javakiteconnect you are using?
    The latest version does subscribe to tokens after it reconnects.
  • sivannarayanagunji
    @sujith i am using kiteconnect.jar , what is the latest version , from where i can download?
  • sujith
    You can download from here.
Sign In or Register to comment.