I am creating code in react.JS to fatch live data using websocket
let web_sockets = new WebSockets({
client_code: "M94633",
feed_token: tokenData.feedToken
});
console.log(user.clientcode)
console.log(tokenData.feedToken)
web_sockets.connect()
.then(() => {
console.log("in side websocket connect")
web_sockets.runScript("mcx_fo|235517", "mw") // SCRIPT: nse_cm|2885, mcx_fo|222900 TASK: mw|sfi|dp crude CRUDEOIL22JULFUT 235517
setTimeout(function () {
web_sockets.close()
}, 30000)
})
web_sockets.on('tick', receiveTick)
function receiveTick(data) {
console.log("receiveTick:::::", data)
}
but it is giving error:
please help