WebSocket Client can be customized with some of the events available. There are 2 new events added to the latest version:
OnBeforeConnect: this event is called just before the client tries to connect to server
OnBeforeWatchDog: sgcWebSocket client has a built-in method to reconnect after a disconnection called WatchDog, this event is called before tries to reconnect.
OnBeforeConnect
This event is called before the client tries to connect to server, the event can be raised because the user manually tries to connect to server or because WatchDog is enabled and automatically tries to reconnect after a disconnection.
This method can be used to customize the client properties, example: you can change here the Host / port of the server that is trying to access after too many retries.
OnBeforeWatchDog
This event is called when WatchDog is enabled and tries to reconnect to server, here you can use the event to use your own reconnection algorithm. Example: you can try first connect to a secure server and if doesn't work try to reconnect to a non secure server.