Skip to content

Instantly share code, notes, and snippets.

@rich97
rich97 / game_node_server.js
Created July 19, 2011 13:04
Game node.js server for socket.io
// New connection
io.of('/game').sockets.on('connection', function(socket) {
// Login using the token sent to us from the client
socket.on('login', function(token) {
// New player requires a new player object
var player = new Player(token);
// We can only perform other options once the login has completed
player.login(function(player) {
// Remember the player on the socket