Open FGRibreau opened 8 years ago
Piece of code that you've marked is invoked only once - when io
variable has been not set. Once io
is set = socket.io server has started, selected block will not be executed.
Try putting console.log
there and you'll see :)
Remember that it's server side code, not browser. Server creates socket.io server only once.
Oh sorry! However the remark on setInterval vs setTimeout still stand :)
At least ClearInterval should be called when the
disconnect
event is triggered by socket.io. Looking at the code, refreshing the page a lot of times would generate a self-deni-of-service :)Don't hesitate to use setTimeout instead by the way.