Advertisement
Pinkishu

Untitled

Oct 12th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             var host;
  2.             if(document.URL.indexOf("dropbox") !== -1) { host = "wss://phasergraalserver-inari.rhcloud.com:8443/"; }
  3.             else { host = "http://localhost:9000"; }
  4.  
  5.             if(g.Connection == null)
  6.             {
  7.                 g.Connection = io(host,{secure:true}).on("connect", function()
  8.                 {
  9.                     var userName = document.getElementById("nick").value;
  10.                     g.Connection.on("login_error",self.loginError);
  11.                     g.Connection.on("login_ok", function(data) { self.loginOk(self,data); } );
  12.                     g.Connection.emit("userLogin",{userName: userName, nick: userName.substring(0,40)});
  13.  
  14.                 } );
  15.                 g.Connection.on("reconnect", function()
  16.                 {
  17.                     var userName = document.getElementById("nick").value;
  18.                     console.log("reconnect!");
  19.                     var p = g.Connection.emit("userLogin",{userName: userName, nick: userName.substring(0,40)});
  20.                     console.log(p);
  21.                     console.log(g.Connection);
  22.                 });
  23.             }
  24.             else
  25.             {
  26.                 g.Connection.io.reconnect();
  27.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement