rtr-nettest / rmbtws

RTR-NetTest Websocket Client
Apache License 2.0
14 stars 11 forks source link

log more error information #12

Closed the01 closed 7 years ago

the01 commented 7 years ago

Logs the error supplied to CALLGLOBALHANDLER (e.g. websocket.onerror)

cproof commented 7 years ago

Thanks for the Pull Request!

Did you test this? What kind of information did you gain? According to the WebSocket spec, the try-catch-block should never be invocated at all if the address is syntactically correct and there is no security exception: https://www.w3.org/TR/websockets/#the-websocket-interface Also, websocket.onerror will only ever receive a simple event without an descriptive message: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications#Connection_errors

the01 commented 7 years ago

Actually, I was testing and having problems, but could not figure out why. And you are right, it was the onclose that gave me more information. Turns out, I was supplying invalid tokens to the server (because of time drift) and in response it just terminates the tcp connection. Since that is not a clean websocket shutdown, the onclose gets called with a CloseEvent.code of 1006.