-
Notifications
You must be signed in to change notification settings - Fork 230
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
Some platforms do not support undefined as WebSocket closing code #485
Comments
This is a bug in their implementations. As per https://www.w3.org/TR/websockets/#the-websocket-interface the signature is
and
that being said, we can of course work around in autobahn rgd above further, I am wondering why you run into thiss exact line in the first place because this part is only used when running under nodejs and finally, it seems that "ws" (the websocket library we use when outside browser, that is on nodejs) has at some point added the close code argument https://github.com/websockets/ws/blob/master/doc/ws.md#websocketclosecode-reason we should forward the close code on this line similar to this line |
Thanks for your understanding. In our environment the exception occurs on this line of the browser block: |
Ok, thanks for clarification! So there are actually 2 things we should (the first is addressing the itch you run into):
|
Exactly! |
Hi, |
Hi,
In our environment, WAMP session authentication is carried out by a specific RPC.
If an AB client tries to connect to the Crossbar server while it's (re)starting, this RPC might not be registered yet to authenticate the client (especially on slow servers).
As expected Crossbar will return error
wamp.error.no_such_procedure
to the client.Then AB's connection handler
self._session.onleave
executes. In particular it calls:https://github.com/crossbario/autobahn-js/blob/master/packages/autobahn/lib/connection.js#L309
In turn this method calls DOM's
WebSocket.close
, with, in this case, valuesundefined
for bothcode
andreason
:https://github.com/crossbario/autobahn-js/blob/master/packages/autobahn/lib/transport/websocket.js#L149
But the WebSocket implementation of some browsers (Microsoft Edge and IE11; Samsung and LG Smart TVs running Chromium) have a different behaviour when
code
is not specified vs whencode
is specified with valueundefined
. In the latter case, the JS engine interpretsundefined
as0
instead of replacing it with internal value 1005 (= "No Status Rcvd").This causes exceptions (depending on the platform):
In this case the AB connection's
onclose
handler is not called, and thereby our code is not aware that reconnection must be attempted.Apparently the implementation of these platforms seems unsuitable, as for a JS function's argument, specifying
undefined
and specifying no value should give equivalent results.Nevertheless we can hardly expect that the browser implementation is changed on the affected platforms/browsers.
As an AB workaround suggestion, method
transport.close
could be completed:Alternatively, calls
self._transport.close();
could be replaced withself._transport.close(1000);
(1000 = "normal closure")Thanks
The text was updated successfully, but these errors were encountered: