-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Websocket server returning 401; can't handle on client side #390
Comments
The pull request #567 fixes the exact issue mentioned by the item 1. Regarding the item 2, I had the same issue when trying to handle a status code 503 during the HTTP handshake (mentioned on the pull request). What seems to be a good solution is to make the Thanks! |
Hello @felippeduran, Have you tested the issue against the current master branch code as well? Does this still cause issues? Regarding the item 2, what do you think of an additional onError call with an exception indicating an invalid http status code? Greetings |
Hello @felippeduran again, I added a reason for the onClose call, if there was an error with the status code or status line. Issue should be solved by that. Greetings |
I have a websocket server that returns 401 on the http handshake
I can't figure out how to get that information on the websocket client
Two things I can't figure out:
onClose is called but with irrelevant code (-1) which I saw in your code that it means "never connected"
why would the client library continue to try to decode the handshake, or something like that, when the socket wasn't upgraded (101)? why not just stop there? The ssl error is irrelevant here and is fired do to the fact that the server did not upgrade the socket
What I did to get the status code from the server was to subclass my own Draft, implement acceptHandshakeAsClient and copyInsance; this gave me access to the handshake response
When I see that the status code is 401 I return NOT_MATCHED
This is the only place I saw I can get the status code, but it makes me do ugly things like saving the status code in a variable to be used by onClose and onError which are then called (but with irrelevant data - code == -1 and error exception is ssl == null)
Thanks
The text was updated successfully, but these errors were encountered: