the socket works for 2-3 mins than randomly stops with this error, i subbed to bnf future Not able to understand what is going wrong node js code for refrence
ticker.connect(); ticker.on("ticks", onTicks);
async function onTicks(data1) { try { const data = data1[0];
if (!data) { console.error("Received empty data array."); return; }
const symbol = data.instrument_token.toString(); const parsedData = await parseSymbol(symbol);
if (subscriptions[parsedData.symbol]) { subscriptions[parsedData.symbol].forEach(socketId => { io.to(socketId).emit('dataUpdate', symbolData[parsedData.symbol]); console.log(`Updated data sent for ${parsedData.symbol} to socket ${socketId}`); }); } } catch (error) { console.error(`Error processing message: ${error}`); } }
function subscribe(item) { item = parseInt(item); // Convert item to an integer var items = [item]; // Create an array with the integer item ticker.subscribe(items); // Subscribe with the array of integers ticker.setMode(ticker.modeFull, items); // Set the mode with the array of integers }