How to call websocket in c#

superashish
How do i call below in c#.
// Javascript example.
var ws = new WebSocket("wss://ws.kite.trade?api_key=xxx&access_token=xxxx");
Tagged:
  • sujith
    You can refer to the documentation here.
  • superashish
    superashish edited April 2020
    Thanks sujith, but how onTike works and when its call.
  • sujith
    Can you elaborate?
  • trade_then
    Hello

    Sorry if my answer appears absurd. but you can place websocket call
    in C# like this. OnTick is an event, to which you subscribe like here.

    you dont have to call websocket as in javascript example you quote.
    Kiteconnect lib handles that for you.

    How it works.

    websocket message is processed here , and if
    Ticks are captured from that message. they are sent to users
    from here. which is how OnTick works.

    Thanks
    Regards

  • ak1194
    @trade_then can you please look whats wrong in this code, https://kite.trade/forum/discussion/comment/25854/#Comment_25854

    , the program does not have error and just terminate clean with 0. dont know why its not capturing ticks.
  • superashish
    First of all, thanks to all of you for your response.

    Actually, I would like to display data into grid from WebSocket. I am using window application using C#.

    I have visited WebSocket live streaming data and implement successfully but can't understand how to get data from "onTike " event or call it.

  • trade_then
    trade_then edited April 2020
    OnTick event is a endpoint of kiteconnect library. for handing over the data to the user.
    you dont call it perse but do something inside it.
    • pass data to a non blocking buffer
      • for storage
      • for flushing when you want to use it later or immediatly
    • pass data to another thread
      • for storage
      • for flushing when you want to use it later or immediatly
    all of this is for use outside of OnTick. That is like in a relay race you are waiting for a runner to pass you a batton
    to run along with it. only difference is the runner that hands you the batton stops and you have to run further. But in our case we have to take the Tick data ( batton ) run ourselves and let the kiteconnect keep running without blocking it.

    Above mentioned tasks are usually acomplished via
    it is from there you use the data for your grid etc. not while in the OnTick method.

    best would be to write your own datastructure for such needs. which is specific for you.

    Thanks
    Regards

Sign In or Register to comment.