how to connect to websocket and retrieve data
-
i am using websocket.org and connecting using the uri provided in api docs.. i generated feed token and sent it to websocket uri as provided in docs.. all i m getting in return is this eJyLrlZKzFayUsrLVtJRKkksBrFzy4Hs3OJ0CLM2FgDEBQq2
please help
-
This post is deleted! -
@akshayavivek06 Please take help of nodeJS tutorials on YouTube. I too learned from those only.
-
@mihirk i am trying to learn this.. any video or tutorial if you can direct me to will be great. Thank you appreciate your response
-
@akshayavivek06 when you send html file, you need to write code snippet to insert those data into html file.
This requirement is not part of forum. Please study seperately.
-
@admin I am able to connect to the websocket with help of SDK provided
please see below my code
const app = require('express')();
const http = require('http').Server(app);
let { WebSocket } = require("smartapi-javascript");var msg="";
let web_socket = new WebSocket({
client_code: "XX",
feed_token: "XX",
script: "nse_cm|1594" //exchange|token for multi stocks use & seperator
});
web_socket.connect();
web_socket.on("tick", receiveTick);function receiveTick(data) {
console.log("Receive stock ticks::", data);
msg=data.msg;
}app.get('/',function(req, res){
res.sendFile(__dirname + '/index.html');
});http.listen(8000,function(){
console.log('listening on *:8000');
});how to get this data streaming in console to show in the index,html ??
i am new to node js please help
-
Hi @akshayavivek06 , please install our NodeJS SDK to establish websocket connection