socket closed after few minutes
-
Re: Socket closed
@admin: can you please check for socket closing issue, I am using nodejs for socket connection
-
@sumeet1990
I am getting this error can you help me ?d:\home page\smart api\test.js:22 web_socket.connect() ^ ReferenceError: web_socket is not defined at Object.<anonymous> (d:\home page\smart api\test.js:22:1) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47
This is the code
let { SmartAPI, WebSocket } = require("smartapi-javascript"); // ########################### Socket Sample Code Starts Here ########################### // Old Websocket // let { ws } = require("websocket"); web_socket.connect() .then(() => { var ACTION_TYPE = "subscribe"; var FEED_TYPE = "order_feed"; console.log("Connected to Web Socket"); web_socket.fetchData(subscribe, order_feed); // ACTION_TYPE: subscribe | unsubscribe FEED_TYPE: order_feed setTimeout(function() { web_socket.close() }, 60000) }); web_socket.on('tick', receiveTick); function receiveTick(data) { console.log("receiveTick:::::", data); }
-
HI @sumeet1990 Currently our team is working on websocket we will get back to you once we have an update.