public static async Task ReconnectionHelper(WebSocketClientBase client) { bool reconnectionSuccessful = false; do { try { await client.Disconnect(); await Task.Delay(1000); reconnectionSuccessful = await client.Connect(client.Endpoint); } catch (Exception ex) { Logger.Log(ex); } } while (!reconnectionSuccessful); }
/// <summary> /// Helper method to handle the reconnection of a web socket client. This method will return when /// a connection is able to successfully be established via the Connect() method. This method /// WILL NOT call any subsequent establishment methods (EX: Authenticate(), Ready(), etc). /// </summary> /// <param name="client">The web socket client to reconnect</param> /// <returns>A task for the reconnection of the websocket</returns> public static async Task Reconnect(InteractiveClient client) { await WebSocketClientBase.ReconnectionHelper(client); }
/// <summary> /// Helper method to handle the reconnection of a web socket client. This method will return when /// a connection is able to successfully be established via the Connect() method. This method /// WILL NOT call any subsequent establishment methods (EX: Authenticate(), Ready(), etc). /// </summary> /// <param name="client">The web socket client to reconnect</param> /// <returns>A task for the reconnection of the websocket</returns> public static async Task Reconnect(ConstellationClient client) { await WebSocketClientBase.ReconnectionHelper(client); }