gimite/web-socket-js issue #35: async onclose.
Filed this bug about this issue: http://github.com/gimite/web-socket-js/issues#issue/35 To work around the flash "recursive call" problem, WebSocket.as has the onclose event disabled in the close() call and the javascript half of the close() call does the onclose() call instead. This is fine, but it needs to be asynchronous to act more like what happens with a normal WebSockets object. The current behavior is that the onclose() method is called inline (synchronously) when the close() is called and this inconsistency make state handling more difficult.
This commit is contained in:
parent
edc4725260
commit
071f2818a8
|
@ -126,7 +126,11 @@
|
|||
// > You are trying to call recursively into the Flash Player which is not allowed.
|
||||
this.readyState = WebSocket.CLOSED;
|
||||
if (this.__timer) clearInterval(this.__timer);
|
||||
if (this.onclose) this.onclose();
|
||||
if (this.onclose) {
|
||||
// Make it asynchronous so that it looks more like an actual
|
||||
// close event
|
||||
setTimeout(this.onclose, 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue