websocket-client
websocket-client copied to clipboard
Handling when unable to connect
I cannot find an event that is triggered when the client is unable to connect. In the event it is is unable to connect it keeps waiting for the connection to happen
Hello @Jcardif,
subscribe to DisconnectionHappened stream.
Then you can call one of:
-
Start()orawait Start()- doesn't throw an exception
- continuously trying to connect with delay specified by
ErrorReconnectTimeout - performs retry until it is disposed or
CancelReconnectionis set to true inside DisconnectionHappened handler - in case of
awaitingit, it will unblock execution only after successful connection
-
await StartOrFail()- throws an exception on connection fail
- doesn't perform retry
- should be
awaitedotherwise, you lose exception