diff --git a/app/Bootstrap/Client.js b/app/Bootstrap/Client.js index 9e4ed07..8da6d65 100755 --- a/app/Bootstrap/Client.js +++ b/app/Bootstrap/Client.js @@ -5,8 +5,8 @@ define([ function(Networker, SocketIO) { - function Client(location) { - this.socket = SocketIO.connect(location); + function Client(location, options) { + this.socket = SocketIO.connect(location, options); this.networker = new Networker(this.socket); } diff --git a/app/Game/Client/Networker.js b/app/Game/Client/Networker.js index e0925e6..93cfe5b 100755 --- a/app/Game/Client/Networker.js +++ b/app/Game/Client/Networker.js @@ -23,14 +23,15 @@ function(ProtocolHelper, GameController) { this.socketLink.on('message', function(message) { self.onMessage(message); }); - +*/ this.socketLink.on('disconnect', function() { self.onDisconnect(); }); -*/ + } Networker.prototype.onConnect = function() { + console.log('connected.') this.join('dungeon'); } /* @@ -40,12 +41,13 @@ function(ProtocolHelper, GameController) { self.processControlCommand(command, options); }); } - +*/ Networker.prototype.onDisconnect = function() { if(this.gameController) this.gameController.destruct(); this.gameController = null; + console.log('disconnected. game destroyed. no auto-reconnect'); } -*/ + Networker.prototype.join = function(channelName){ this.sendCommand('join', channelName); } diff --git a/client.js b/client.js index 86a1bfe..1fc4c81 100755 --- a/client.js +++ b/client.js @@ -6,6 +6,17 @@ var inspector = {}; requirejs(["Bootstrap/Client"], function(Client) { - var client = new Client(location.href); + var options = { + "reconnect": false, + "reconnection delay": 500, + "max reconnection attempts": 10, + + "transports": [ + "websocket", + "flashsocket" + ], + }; + + var client = new Client(location.href, options); inspector.client = client; }); \ No newline at end of file