This exact code doesn't work, but, I was hoping something like it was:

io.sockets.on('connection', function(socket) {
    socket.on('heartbeat', function() {
        // Do something here...
    });
});

Is something like this possible? I mean, I know I can just make a different function that triggers every, say, 15 seconds using a setInterval:

io.sockets.on('connection', function(socket) {
    setInterval(function() {
        // Do something
    },15000);
});

But since the heartbeat is already running at this interval, why not make use of it?

In any case, any insight would be greatly appreciated.

Edit
Report