private async void RtmpConn_Disconnected(object sender, EventArgs e) { Connected = false; await RtmpConn.RecreateConnection(ReconnectToken); var bc = $"bc-{Account.AccountID}"; var gn = $"gn-{Account.AccountID}"; var cn = $"cn-{Account.AccountID}"; var tasks = new[] { RtmpConn.SubscribeAsync("my-rtmps", "messagingDestination", "bc", bc), RtmpConn.SubscribeAsync("my-rtmps", "messagingDestination", gn, gn), RtmpConn.SubscribeAsync("my-rtmps", "messagingDestination", cn, cn), }; await Task.WhenAll(tasks); Connected = true; }
public void Logout() { if (Connected) { try { SaveSettings(Settings.Username, Settings); RtmpConn.MessageReceived -= RtmpConn_MessageReceived; HeartbeatTimer.Dispose(); new Thread(async() => { Connected = false; CurrentQueue?.Cancel(); CurrentLobby?.Dispose(); await RiotServices.LoginService.Logout(); await RtmpConn.LogoutAsync(); RtmpConn.Close(); }).Start(); } catch { } } ChatManager?.Dispose(); }