Closed ksimmi closed 2 months ago
In v0.28.0, I added ConnectionError
: https://github.com/socketry/async-websocket/blob/534cad73595292b82b88de3b66d10773106c254d/lib/async/websocket/error.rb#L19-L28
This allows you to catch connection errors and check the response status etc.
Hello.
I'm trying to emulate partners API behavior with my stub server.
On the client side I have to use a Bearer token on requesting new connection. I did
Async::WebSocket::Client.connect(Async::HTTP::Endpoint.parse(URL_SOCK), headers: {Authorization: token}) do ...
On the server side I trying to validate the token before create connection:
The client raises
Async::WebSocket::ProtocolError
.I can leave the code like this because it solves my problem by checking message includes
401
substring, but I doubt that I did it correctly.Thank you.