private void Client_ReconnectComplete(object sender, EventArgs e) { // ignore callbacks from discarded objects. if (!Object.ReferenceEquals(sender, reconnectHandler)) { return; } session = reconnectHandler.Session; reconnectHandler.Dispose(); reconnectHandler = null; Console.WriteLine("--- RECONNECTED ---"); ConnectionSatus = true; OnConnectionStatusChange?.Invoke(this, true); }
private void Client_KeepAlive(Session sender, KeepAliveEventArgs e) { if (e.Status != null && ServiceResult.IsNotGood(e.Status)) { Console.WriteLine("{0} {1}/{2}", e.Status, sender.OutstandingRequestCount, sender.DefunctRequestCount); if (reconnectHandler == null) { ConnectionSatus = false; OnConnectionStatusChange?.Invoke(this, false); Console.WriteLine("--- RECONNECTING ---"); reconnectHandler = new SessionReconnectHandler(); reconnectHandler.BeginReconnect(sender, ReconnectPeriod * 1000, Client_ReconnectComplete); } } }
private void fireOnConnectionStatusChange() { OnConnectionStatusChange?.Invoke(); }