Friday, 31 July 2020

Using websocket ( ws ) with live data streaming

let count = 1const progressbar = setInterval(() => {count = count + 1}, 1000);I have a simple interval as you can see above and I like to use this as feed for websocket.in my websocket script I havewss.on('connection' ,  ws => {console.log('user is connected to the server') ws.send(count)    })Now the count is send and received on the client side but it comes back as 1. I wish for the data to be sent on the interval and I was thinking if it is wise to put the whole websocket inside the interval or not.​Please guide me

Submitted July 31, 2020 at 10:57AM by godandglory2

No comments:

Post a Comment