diff --git a/client/garageserver.io.js b/client/garageserver.io.js index b1516eb..d46c9e6 100644 --- a/client/garageserver.io.js +++ b/client/garageserver.io.js @@ -187,7 +187,7 @@ var GarageServerIO = (function (socketio) { registerSocketEvents = function () { _socket.on('connect', function () { - _stateController.id = _socket.socket.sessionid; + _stateController.id = _socket.io.engine.id; if (_options.logging) { console.log('garageserver.io:: socket connect'); } @@ -197,7 +197,7 @@ var GarageServerIO = (function (socketio) { } }); - _socket.on('state', function (data) { + _socket.on('s', function (data) { if (_options.onWorldState) { _options.onWorldState(data.worldState); } @@ -219,11 +219,11 @@ var GarageServerIO = (function (socketio) { } setInterval(function (){ - _socket.emit('ping', new Date().getTime()); + _socket.emit('p', new Date().getTime()); }, _stateController.pingInterval); }); - _socket.on('disconnect', function () { + _socket.on('d', function () { if (_options.logging) { console.log('garageserver.io:: socket disconnect'); } @@ -241,11 +241,11 @@ var GarageServerIO = (function (socketio) { } }); - _socket.on('update', function (data) { + _socket.on('u', function (data) { update(data); }); - _socket.on('ping', function (data) { + _socket.on('p', function (data) { _stateController.pingDelay = new Date().getTime() - data; if (_options.logging) { console.log('garageserver.io:: socket ping delay ' + _stateController.pingDelay); @@ -255,7 +255,7 @@ var GarageServerIO = (function (socketio) { } }); - _socket.on('removePlayer', function (id) { + _socket.on('rp', function (id) { removePlayer(id); if (_options.logging) { console.log('garageserver.io:: socket removePlayer ' + id); @@ -265,7 +265,7 @@ var GarageServerIO = (function (socketio) { } }); - _socket.on('removeEntity', function (id) { + _socket.on('re', function (id) { removeEntity(id); if (_options.logging) { console.log('garageserver.io:: socket removeEntity ' + id); @@ -275,7 +275,7 @@ var GarageServerIO = (function (socketio) { } }); - _socket.on('event', function(data) { + _socket.on('e', function(data) { if (_options.logging) { console.log('garageserver.io:: socket event ' + data); } @@ -290,7 +290,7 @@ var GarageServerIO = (function (socketio) { }, sendServerEvent = function (data) { - _socket.emit('event', data); + _socket.emit('e', data); }, addInput = function (clientInput) { @@ -300,7 +300,7 @@ var GarageServerIO = (function (socketio) { player.inputController.add(clientInput); player.state = _options.onUpdatePlayerPrediction(player.state, [{ input: clientInput }], _stateController.physicsDelta); } - _socket.emit('input', [ clientInput, player.inputController.sequenceNumber, _stateController.renderTime ]); + _socket.emit('i', [ clientInput, player.inputController.sequenceNumber, _stateController.renderTime ]); } }); }, diff --git a/example/package.json b/example/package.json index 4a29788..1d77f95 100644 --- a/example/package.json +++ b/example/package.json @@ -10,6 +10,6 @@ "dependencies": { "express": "3.1.0", "jade": "*", - "socket.io": "0.9.14" + "socket.io": "1.1.0" } } \ No newline at end of file diff --git a/example/public/javascripts/game.js b/example/public/javascripts/game.js index 4b86f5f..ffa4a22 100644 --- a/example/public/javascripts/game.js +++ b/example/public/javascripts/game.js @@ -7,7 +7,7 @@ $(function () { window.addEventListener('resize', resizeCanvas, false); - GarageServerIO.initializeGarageServer('http://garageserver_io.jbillmann.c9.io', { + GarageServerIO.initializeGarageServer('https://garageserver_io-c9-jbillmann.c9.io', { logging: true, onReady: startGame, onUpdatePlayerPrediction: GamePhysics.getNewPlayerState,