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.
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 });
@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
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)
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.
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.
Can you let us know more about your setup as well?
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);
}
Error: certificate has expired
code: 'CERT_HAS_EXPIRED'
@sujith Kindly look into this.
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
}
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