From 272d5a22fd1c0536677d48ca54622ac2da8d38c2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 21 Sep 2012 08:40:32 -0400 Subject: [PATCH] from now on disconnecting - trying to do new connection --- ChangeLog | 1 + lib/client/socket.js | 43 ++++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1867aba..a1932e22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,7 @@ disabled in browsers. * Added ability convert charset from win to unicode on win32. +* From now on disconnecting - trying to do new connection. 2012.08.24, Version 0.1.6 diff --git a/lib/client/socket.js b/lib/client/socket.js index 6d1e2571..b67bed04 100644 --- a/lib/client/socket.js +++ b/lib/client/socket.js @@ -1,32 +1,37 @@ /* module make possible connectoin thrue socket.io on a client */ -var CloudCommander, io, socket; +var CloudCommander, io; (function(){ "use strict"; var cloudcmd = CloudCommander, Util = cloudcmd.Util, Messages = [], + socket, JqueryTerminal = cloudcmd.Terminal.JqueryTerminal; + + var socketConfig_f = function(){ + socket = io.connect(document.location.hostname); + + cloudcmd.Socket = socket; + + socket.on('connect', function () { + outToTerminal('socket connected'); + }); + + socket.on('message', function (msg) { + outToTerminal(msg); + + }); + + socket.on('disconnect', function () { + outToTerminal('socket disconected'); + socketConfig_f(); + }); + }; + Util.jsload("/socket.io/lib/socket.io.js", { - onload : function(){ - socket = io.connect(document.location.hostname); - - cloudcmd.Socket = socket; - - socket.on('connect', function () { - outToTerminal('socket connected'); - }); - - socket.on('message', function (msg) { - outToTerminal(msg); - - }); - - socket.on('disconnect', function () { - outToTerminal('socket disconected'); - }); - }, + onload : socketConfig_f, onerror : function(){ console.log('could not connect to socket.io\n'+