Created
May 6, 2012 17:33
-
-
Save xenophy/2623432 to your computer and use it in GitHub Desktop.
Use WebSocket(socket.io) on Ext Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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