Skip to content

Instantly share code, notes, and snippets.

@xenophy
Created May 6, 2012 17:33
Show Gist options
  • Save xenophy/2623432 to your computer and use it in GitHub Desktop.
Save xenophy/2623432 to your computer and use it in GitHub Desktop.
Use WebSocket(socket.io) on Ext Server
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
module.exports = {
connect: function(socket) {
socket.emit('news', { hello: 'world' });
},
disconnect: function() {
console.log("disconnect.");
},
onMyEvent: function(data) {
console.log(data);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment