@admin my code
exports.watchStockPrice = async (data,socket) => {
let web_socket = new WebSocket({
client_code: "DIYD85289",
feed_token: initSmartApi.getApiCredentials().feedToken,
});
const tokens = data.tokens;
await web_socket.connect();
//
web_socket.runScript(tokens,"mw");
//setTimeout(() =>{web_socket.close()},5000);
web_socket.on('tick', (data) => {
sendStockPrice(data,socket.id);
});
}
function sendStockPrice(data,socketId) {
socketInit.getIO().to(socketId).emit("watchStockPrice",data);
}