Live Data Streaming

DV3508
Hi, I am building my own trading platform on PHP. I just wanted ask using the Web sockets, can I get the live quotes? And will there be any delay in such live quotes as compared to Zerodha kite?
  • Vivek
    @DV3508 There won't be any delay from Kite web since we use same streaming api.
  • DV3508
    Thank you so much vivek for your valuable reply. and correct me if i am wrong this is the link for web socket to stream live data right? https://github.com/instruritesh/ZStreamingQuote
  • Vivek
    @DV3508 Its a third party java client. Please check here for list of our libraries.
  • DV3508
    Hi Vivek, Websockets are available in PHP right?
  • Vivek
    Vivek edited September 2016
    @DV3508 We don't have websocket streaming in Php client yet
  • DV3508
    Hi Vivek, then what is the Websocket available? and how to use the same in PHP? can you please help me.

    and also, can you please share me the reflink for the websockets?
  • Vivek
    @DV3508 We haven't integrated live streaming to PHP client yet. You can use Node or Python client or other third party clients.

    Here is the docs for Websocket streaming - https://kite.trade/docs/connect/v1/#streaming-websocket
  • DV3508
    DV3508 edited October 2016
    Hi Vivek,

    I am not getting binary even after encoding the data structure to JSON.

    Here is the sample code. Please help me how to decode the same to get live quotes.

    function WebSocketTest() { if ("WebSocket" in window) { // Let us open a web socket var ws = new WebSocket("wss://websocket.kite.trade/?api_key=&user_id=&public_token="); ws.binaryType = "blob"; ws.onopen = function() { // Web Socket is connected, send data using send() var message = {"a": "mode", "v": ["full", [408065]]}; ws.send(JSON.stringify(message)) }; ws.onmessage = function (t) { if(t.data instanceof ArrayBuffer) { if(t.data.byteLength > 2) { //var d = parseBinary(t.data); console.log(t.data); /* if(d) { trigger("tick", [d]); } */ } } if(t.data instanceof Blob){ t.data = new Blob(); console.log(t.data); } }; ws.onclose = function() { // websocket is closed. console.log("Connection is closed..."); }; } else { // The browser doesn't support WebSocket alert("WebSocket NOT supported by your Browser!"); } }
  • Vivek
    @DV3508 can you post formatted code here? the current one is unreadable now
  • DV3508
    Hi Vivek,

    I think i have found the Solution for the same Issue in this forum. Thank you anyway.
This discussion has been closed.