Created
March 27, 2012 14:55
-
-
Save ruby0x1/2216589 to your computer and use it in GitHub Desktop.
Multi-player games in HTML5 : Socket.io on the server side with session
This file contains 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) { | |
//create a new player, which registers its events | |
var connection = new Session( socket ); | |
//add to the list of connections (for finding a game) | |
server.addConnection( connection ); | |
//This will send a message to all clients saying that they connected, | |
//And hand them their serverid for future interactions. | |
socket.emit('onConnect', { serverid : connection.serverid }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment