Data not streaming

mijanur
Hello sir, Is there any problem today ? cause data is not streaming in my node application, i am using it more than 8 months. Please indicate the problem.
  • sgsaran
    Me too face the same issue today morning.
  • mijanur
    @sgsaran is it working now ?
  • sgsaran
    Now it is fine @mijanur
  • sujith
    Can you give us a stack trace? Try running in debug mode and get the complete stacktrace or set on error callback and give us the error message.

    Can you let us know more about your setup as well?
  • mijanur
    mijanur edited June 2020
    @sujith how to make a callback on ticker subscribe ? or debug mode ? to check the issue i am using command prompt. but not getting any error
  • mijanur
    here is my code

    var http = require("http");

    http.createServer(function (request, response) {
    // Send the HTTP header
    // HTTP Status: 200 : OK
    // Content Type: text/plain
    response.writeHead(200, {'Content-Type': 'text/plain'});

    // Send the response body as "Hello World"
    response.end('Hello World\n');
    }).listen(8081);

    // Console will print the message
    console.log('Server running at http://127.0.0.1:8081/');




    var KiteConnect = require("kiteconnect").KiteConnect;

    var reqtoken = "S466dupHoe6ICjkCeDE1pnaXP7dxE7KT";

    var access_token = '';

    var public_token= '';

    var kc = new KiteConnect({
    api_key: "3tss82wlr0i6hsr1"
    });


    console.log(kc.getLoginURL());



    kc.generateSession(reqtoken, "zl8uz8jouqqkbo0gwyo73z8tudke8xyj")
    .then(function(response) {
    console.log(response);
    console.log("=============================================\n");
    var acct = response["access_token"];
    console.log("acc : "+acct);
    kc.setAccessToken(acct);
    access_token=acct;
    init();
    })
    .catch(function(err) {
    console.log(err);
    });

    function init() {
    // Fetch equity margins.
    // You can have other api calls here.
    kc.getMargins()
    .then(function(response) {
    // You got user's margin details.
    console.log(response);
    }).catch(function(err) {
    // Something went wrong.
    });
    }



    var KiteTicker = require("kiteconnect").KiteTicker;
    var ticker = new KiteTicker({
    api_key: "3tss82wlr0i6hsr1",
    access_token: access_token
    });

    ticker.connect();
    ticker.on("ticks", onTicks);
    ticker.on("connect", subscribe);

    function onTicks(ticks) {
    console.log("Ticks", ticks);
    }

    function subscribe() {
    var items = [55699207];
    ticker.subscribe(items);
    ticker.setMode(ticker.modeFull, items);
    }
  • Bhaveshsjain
    Bhaveshsjain edited June 2020
    Same isssue.. It seems their SSL certificate has expired.

    Error: certificate has expired
    code: 'CERT_HAS_EXPIRED'

    @sujith Kindly look into this.
  • mijanur
    @Bhaveshsjain this is not an error, I can't see any error or warning, I think subscribe function is not working properly, might be some changes in the server
  • Bhaveshsjain
    @mijanur try using ticker.on("error")
  • mijanur
    mijanur edited June 2020
    @Bhaveshsjain I can see on the link access_token is not setting by the package
  • mijanur
    Error Error: unexpected server response (400)
    at ClientRequest.response
    type: 'error',
    target: WebSocket {
    _events: [Object: null prototype] {
    open: [Function],
    message: [Function],
    error: [Function],
    close: [Function]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    _socket: null,
    _ultron: null,
    _closeReceived: false,
    bytesReceived: 0,
    readyState: 0,
    supports: { binary: true },
    extensions: {},
    _binaryType: 'arraybuffer',
    _isServer: false,
    url: 'wss://ws.kite.trade/?api_key=3tss82wlr0i6hsr1&access_token=&uid=1591015939747',
    protocolVersion: 13,
    [Symbol(kCapture)]: false
    }
  • Bhaveshsjain
    @sujith Please update on SSL issue. it shouldn't take so much time to resolve
  • vikashrivastav
    Looks like this is still happening. Any one lucky?
  • mijanur
    mijanur edited June 2020
    now SSL ERROR :blush:

    Error: certificate has expired
    at TLSSocket.onConnectSecure (_tls_wrap.js:1317)
    at TLSSocket.emit (events.js:203)
    at TLSSocket._finishInit (_tls_wrap.js:792)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:606)



    but its working in command prompt
  • sujith
    This issue is because of an old root CA certificate expired on May 30th that affects old systems that are not updated with new root CA certificates. More about it: https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA03l00000117LT . Ideally all systems should be up to date with updated CA certificates. We have removed this root CA from our chain.
  • sujith
    If you're using NodeJs, please upgrade to latest versions.
  • vikashrivastav
    this is a server certificate that you are referring to and no Nodejs clients need update. My app is running now without any update. Should have been updated by Zerodha on time.
  • vikashrivastav
    @sujith Thanks for fixing this
  • mijanur
    Yes we can do nothing on this error, its not in our end, anyway, thanks for resolving the issue, now its working fine
Sign In or Register to comment.