Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error / close callback called when socket is invalidated #92

Closed
jpcarlino opened this issue Sep 13, 2011 · 2 comments
Closed

No error / close callback called when socket is invalidated #92

jpcarlino opened this issue Sep 13, 2011 · 2 comments

Comments

@jpcarlino
Copy link

I'm not completely sure if this is a collateral problem but from the tests i've performed it seems that a flash exception is thrown when the websocket is invalidated before any javascript callback has been called.

My application sends a keepalive packet every 30 seconds to the server. If I suddenly stop the server while connection is in progress, first of all, the client doesn't notice it (no event is triggered by flash bridge). Second, when the heartbeat is sent, flash bridge throws this error:

Error calling method on NPObject!

the javascript line in question is the send function, as expected:

var result = WebSocket.__flash.send(this.__id, encodeURIComponent(data));

looking into flash debugger i see:

Error: Error #2002: Operation attempted on invalid socket.
at flash.net::Socket/flush()
at com.hurlant.crypto.tls::TLSSocket/flush()
at net.gimite.websocket::WebSocket/send()
at net.gimite.websocket::WebSocketMain/send()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at flash.external::ExternalInterface$/_callIn()
at Function/<anonymous>()

so, in short, when socket is invalidated (for example, connection broken) no event is triggered, and it seems i can't catch that error. Any clue?

@gimite
Copy link
Owner

gimite commented Sep 18, 2011

Thanks for the report. How do you "suddenly stop the server"? I use em-websocket and tried to kill it with kill -INT and kill -KILL but I couldn't reproduce it (onclose event fires as usual). Probably it can happen when the client somehow doesn't notice the socket close immediately, but noticed that when it tries to send something? I'm thinking of firing "error" event on exception in send().

@gimite
Copy link
Owner

gimite commented Dec 17, 2011

Committed a change to fire close event on exception in send(). I cannot reproduce the situation, but hopefully it works.

@gimite gimite closed this as completed Dec 17, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants