Commit 071f2818 authored by Joel Martin's avatar Joel Martin

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.
parent edc47252
......@@ -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);
}
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment