Skip to content

Commit

Permalink
send a heartbeat every 5 seconds for the other clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Pitiyanuvath committed Jul 28, 2011
1 parent 4caa684 commit 9e80af2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion public/javascripts/watchmaker.js
Expand Up @@ -249,7 +249,10 @@ var nko = {};
var dudes = {};
var ws = io.connect();
ws.on('connect', function() {
ws.send(JSON.stringify({ obj: me }));
(function heartbeat() {
ws.send(JSON.stringify({ obj: me }));
setTimeout(heartbeat, 5000);
})();
});
ws.on('message', function(data) {
var data = JSON.parse(data)
Expand Down

0 comments on commit 9e80af2

Please sign in to comment.