Friday, 9 June 2017

setInterval and setTimeout stopping automatically

I am running a node and express server along with WS (WebSocket). I am maintaining connected users(ws clients) map and constantly sending some message to connected clients at a fixed regular interval.

All of this works fine expect the unexpected behavior of setInterval and setTimout.Don't even know why is this happening.Earlier I used setInterval, then I switched to recursive setTimeout but the same thing happens. Node keeps on running and accepts HTTP requests on same port and same endpoint as of WebSocket but the scheduler for checking connected clients stops.

why is this happening and how can i make it working non stop.



via Nikhil

No comments:

Post a Comment