Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
Created March 27, 2012 14:54
Show Gist options
  • Save ruby0x1/2216580 to your computer and use it in GitHub Desktop.
Save ruby0x1/2216580 to your computer and use it in GitHub Desktop.
Multi-player games in HTML5 : Server Side Server Class
var Server = Class.extend({
init : function( ) {
this.connections = [];
this.games = [];
},
addConnection : function( connection ) {
console.log('\t :: Server :: A player has connected ' + connection.serverid );
//Add to the list of server connections
this.connections.push( connection );
},
removeConnection : function( connection ) {
//Remove the connection from the list of server connections
server.connections.erase( connection );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment