Move callback initialization to prevent race condition
This commit is contained in:
parent
a882f598d6
commit
a3331ff758
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue