Part of my last pull request that was not absorbed gave access to the headers from the 'first frame'. The issue that remains is how to handle problems before we get that far. In the case of 302 from the /info request due to 'not logged in' there is presently no way to know the result of that initial upgrade request. It would be very helpful in the event of a connection error, to have the connection error handling callback send back the http response code and/or text.
This was my starting point
static Future<_WSStompConnector> start(String url,
{void onConnectionError(event)}) {
WebSocket ws = new WebSocket(url);
ws.onError.listen(onConnectionError);
return new _WSStompConnector(ws)._starting.future;
}
which only gives knowledge of the connection error but not of status code so it is an incomplete solution. If you have suggestions I can try an implementation and offer a pull request.
Not sure how to handle it either. However, I modified the code to make it easy to handle (at the application level).
The onFault argument is added to handle exceptions (while onError is only for handling the ERROR fames). Thus, the error event received in WebSocket will be passed to onFault().
connectWith() is added to accept WebSocket, which you can add extra handling before passing to the Stomp client.
Part of my last pull request that was not absorbed gave access to the headers from the 'first frame'. The issue that remains is how to handle problems before we get that far. In the case of 302 from the /info request due to 'not logged in' there is presently no way to know the result of that initial upgrade request. It would be very helpful in the event of a connection error, to have the connection error handling callback send back the http response code and/or text.
This was my starting point
which only gives knowledge of the connection error but not of status code so it is an incomplete solution. If you have suggestions I can try an implementation and offer a pull request.