Closed Caceresenzo closed 3 years ago
Yes. I can expose a few methods/fields so that a user can check on the socket state and add listeners to state changes. I'll add that soon.
@Caceresenzo
Release 7.2
adds WebsocketStateListener
to manually listen to Websocket state changes (onConnected
, onDisconnected
, and onError
). Set the WebsocketStateListener
to the desired WebsocketClient
via AlpacaAPI.setAlpacaStreamWebsocketStateListener()
or AlpacaAPI.setMarketDataStreamWebsocketStateListener()
.
Hi
Not having the possibility to know in what state the socket currently is is leading to unexpected errors.
I often get:
I can see that the method to do that is public, but not the accessor to the client object.
https://github.com/Petersoj/alpaca-java/blob/d4e5ac830767a6b69259192c60645433272435a6/src/main/java/net/jacobpeterson/alpaca/websocket/broker/client/AlpacaWebsocketClient.java#L238
https://github.com/Petersoj/alpaca-java/blob/d4e5ac830767a6b69259192c60645433272435a6/src/main/java/net/jacobpeterson/alpaca/AlpacaAPI.java#L89
Would you mind implementing a simple:
Thanks in advance