You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Async client/server on_error calls if there some error befor ws handshake done (IO error/SSL handshake/Invalid token/ protocol) . And in this case on_close did not call. on_close calls if ws handshake done. In case of IO error we call on_close with (false, 1001, "Going away"). And in this caseon_error` did not call.
Is it correct behavior?
The text was updated successfully, but these errors were encountered:
I think on_close should be called when the client will not be able to work with the ws any more.
You raised one good question: If the connection has never been open, should on_close and on_error be called anyways?
I tend to call on_close and on_error also when the connection failed. This would make async error handling easier.
BTW: on_error should always be calls before on_close. (This is how node.js does it with sockets).
May be we should call on_close only if there was on_open event.
And call on_error on any errors.
But there may be cases when other side just close connection and in this case may be we shuld just call on_close with status 1001?
Async client/server
on_error
calls if there some error befor ws handshake done (IO error/SSL handshake/Invalid token/ protocol) . And in this caseon_close
did not call.on_close
calls if ws handshake done. In case of IO error we callon_close
with(false, 1001, "Going away"). And in this case
on_error` did not call.Is it correct behavior?
The text was updated successfully, but these errors were encountered: