Greetings to all!
There was a task, in the interval every 5 minutes to send, to everyone who is on the page a certain action, how to send?
var app = require('http').createServer(handler), io = require('socket.io').listen(app), static = require('node-static'); // for serving files var fileServer = new static.Server('./'); // Users var clients = 0; app.listen(8080); function handler (request, response) { request.addListener('end', function () { fileServer.serve(request, response); }); } setInterval(function(){ io.sockets.emit('timer_sec', {'text':'Таймер прошел!'}) }, 10000); io.set('log level', 1); io.sockets.on('connection', function (socket) { ++clients; socket.on('mousemove', function (data) { socket.broadcast.emit('moving', data); }); socket.on('disconnect', function () { —clients; }); });