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:
- Where can I get the http status code returned form the server (401 in this case)
onClose is called but with irrelevant code (-1) which I saw in your code that it means "never connected"
- onError is called but for totally different reason. I get onError ssl == null
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
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