Move callback initialization to prevent race condition

This commit is contained in:
calzoneman 2013-05-28 17:06:23 -04:00
parent a882f598d6
commit a3331ff758
2 changed files with 12 additions and 12 deletions

View file

@ -740,3 +740,15 @@ Callbacks = {
closePoll();
}
}
$.getScript(IO_URL+"/socket.io/socket.io.js", function() {
try {
socket = io.connect(IO_URL);
for(var key in Callbacks) {
socket.on(key, Callbacks[key]);
}
}
catch(e) {
Callbacks.disconnect();
}
});

View file

@ -11,15 +11,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var IO_URL = "http://localhost:1337";
var WEB_URL = "http://localhost:8080";
$.getScript(IO_URL+"/socket.io/socket.io.js", function() {
try {
socket = io.connect(IO_URL);
for(var key in Callbacks) {
socket.on(key, Callbacks[key]);
}
}
catch(e) {
Callbacks.disconnect();
}
});