mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
minor changes
This commit is contained in:
parent
4c56e5fb7d
commit
449a279b4f
1 changed files with 18 additions and 22 deletions
|
|
@ -8,30 +8,26 @@ var CloudCommander, io;
|
|||
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 : socketConfig_f,
|
||||
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');
|
||||
});
|
||||
},
|
||||
|
||||
onerror : function(){
|
||||
console.log('could not connect to socket.io\n'+
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue