Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var host;
- if(document.URL.indexOf("dropbox") !== -1) { host = "wss://phasergraalserver-inari.rhcloud.com:8443/"; }
- else { host = "http://localhost:9000"; }
- if(g.Connection == null)
- {
- g.Connection = io(host,{secure:true}).on("connect", function()
- {
- var userName = document.getElementById("nick").value;
- g.Connection.on("login_error",self.loginError);
- g.Connection.on("login_ok", function(data) { self.loginOk(self,data); } );
- g.Connection.emit("userLogin",{userName: userName, nick: userName.substring(0,40)});
- } );
- g.Connection.on("reconnect", function()
- {
- var userName = document.getElementById("nick").value;
- console.log("reconnect!");
- var p = g.Connection.emit("userLogin",{userName: userName, nick: userName.substring(0,40)});
- console.log(p);
- console.log(g.Connection);
- });
- }
- else
- {
- g.Connection.io.reconnect();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement