Skip to content

Instantly share code, notes, and snippets.

@jmaicher
Created November 3, 2012 20:07
Show Gist options
  • Save jmaicher/4008546 to your computer and use it in GitHub Desktop.
Save jmaicher/4008546 to your computer and use it in GitHub Desktop.
var socket = io.connect('/global');
socket.on('server-news', function(data) {
console.log(data.i);
socket.emit('client-news', { i: data.i + 1 });
});
io.of('/global').on('connection', function(socket) {
socket.emit('server-news', { i: i });
socket.on('client-news', function(data) {
i = data.i;
console.log(i);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment