private async void ChatClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            // set the UI to disconnected
            await ConnectionStatus.Dispatcher.BeginInvoke((Action)(() => ConnectionStatus.Text = "Disconnection occurred, awaiting reconnection..."));

            // set the taskbar icon to disconnected on hover
            MainIcon.ToolTipText = "Smite Mixer Idler (Disconnected)";
            // set the main icon to the grey one because we're not connected
            MainIcon.Icon = Properties.Resources.lumbridgeAvatarGrey;

            do
            {
                // wait here and try to reconnect
                await Task.Delay(2500);
            }
            // try to connect to chat and authenticate
            while (!await _chatClient.Connect() && !await _chatClient.Authenticate());

            // when we reconnect set the UI back to connected
            await ConnectionStatus.Dispatcher.BeginInvoke((Action)(() => ConnectionStatus.Text = "Connected"));

            // set the taskbar icon to connected on hover
            MainIcon.ToolTipText = "Smite Mixer Idler (Connected)";
            // set the taskbar icon back to the coloured one because we're connected
            MainIcon.Icon = Properties.Resources.lumbridgeAvatar;
        }
Example #2
0
        private static async void ChatClient_DoReconnect(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            Plugin.Log("Reconnecting Mixer");
            await Task.Delay(2000);

            await Reconnect();
        }
Example #3
0
 private void Ws_OnClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     Logger.Log("ws_Closed");
     Ws.OnOpened  -= Ws_OnOpened;
     Ws.OnClosed  -= Ws_OnClosed;
     Ws.OnData    -= Ws_OnData;
     Ws.OnMessage -= Ws_OnMessage;
     Ws.OnError   -= Ws_OnError;
     OnClose();
 }
        private static async void ChatClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            System.Console.WriteLine("Disconnection Occurred, attempting reconnection...");

            do
            {
                await Task.Delay(2500);
            }while (!await Program.chatClient.Connect() && !await Program.chatClient.Authenticate());

            System.Console.WriteLine("Reconnection successful");
        }
Example #5
0
        private async void WebSocket_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            GlobalEvents.ServiceDisconnect("GawkBox");

            do
            {
                await Task.Delay(2500);
            }while (!await this.Connect());

            GlobalEvents.ServiceReconnect("GawkBox");
        }
        private async void InteractiveClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            this.InteractiveDataTextBlock.Text += "Disconnection Occurred, attempting reconnection..." + Environment.NewLine;

            do
            {
                await Task.Delay(2500);
            }while (!await this.interactiveClient.Connect() && !await this.interactiveClient.Ready());

            this.InteractiveDataTextBlock.Text += "Reconnection successful" + Environment.NewLine;
        }
        private async void ChatClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            this.chatMessages.Add(new ChatMessage("SYSTEM", "Disconnection Occurred, attempting reconnection..."));

            System.Console.WriteLine();

            do
            {
                await ChatClient.Reconnect(this.chatClient);
            } while (!await this.chatClient.Authenticate());

            this.chatMessages.Add(new ChatMessage("SYSTEM", "Reconnection successful"));
        }
Example #8
0
        private void Ws_Closed(object sender, ClosedEventArgs e)
        {
            string code   = "";
            string reason = "";

            if (e != null)
            {
                System.Net.WebSockets.WebSocketCloseStatus closeStatus = (System.Net.WebSockets.WebSocketCloseStatus)e.Code;
                code   = e.Code + "(" + closeStatus.ToString() + ")";
                reason = e.Reason;
            }
            this.Status = StompStatus.Disconnected;
            Callbacks.Disconnected?.Invoke();
            this.Debug($"Whoops! WebSocket Closed: {code} {reason}");
            this.CleanUp();
        }
Example #9
0
        private async void Websocket_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            ChannelSession.DisconnectionOccurred(MixItUp.Base.Resources.VTubeStudio);

            Result result = new Result();

            do
            {
                await this.Disconnect();

                await Task.Delay(5000);

                result = await this.InitializeInternal();
            }while (!result.Success);

            ChannelSession.ReconnectionOccurred(MixItUp.Base.Resources.VTubeStudio);
        }
        private async void PubSub_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            ChannelSession.DisconnectionOccurred("Twitch PubSub");

            Result result;

            await this.Disconnect();

            do
            {
                await Task.Delay(2500);

                result = await this.Connect();
            }while (!result.Success);

            ChannelSession.ReconnectionOccurred("Twitch PubSub");
        }
Example #11
0
        /// <summary>
        /// Disconnects the gateway
        /// </summary>
        public virtual async Task <DisconnectStatus> DisconnectAsync(
            System.Net.WebSockets.WebSocketCloseStatus closeStatus = System.Net.WebSockets.WebSocketCloseStatus.NormalClosure,
            string reason = ""
            )
        {
            if (_externalToken == null)
            {
                //No connection has been made to this gateway
                return(DisconnectStatus.NotConnected);
            }

            if (linkedTokenSource.IsCancellationRequested)
            {
                linkedTokenSource.Token.ThrowIfCancellationRequested();
            }

            await Socket.DisconnectAsync(closeStatus, reason, linkedTokenSource.Token);

            //Cancelling our token should cause everything to stop
            linkedTokenSource.Cancel();
            linkedTokenSource.Dispose();

            return(DisconnectStatus.Pending);
        }
Example #12
0
 private void OnClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     Console.WriteLine("Closed.");
 }
Example #13
0
 private void Socket_OnClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     throw new NotImplementedException();
 }
Example #14
0
 public async Task Close(System.Net.WebSockets.WebSocketCloseStatus status)
 {
     await Base.CloseAsync(status, "", CancellationToken.None);
 }
Example #15
0
 private static void ChatClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
 {
     Plugin.Log("Disconnected Mixer");
     OnDisconnected?.Invoke();
 }
Example #16
0
        private static async void InteractiveClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            System.Console.WriteLine("Disconnection Occurred, attempting reconnection...");

            do
            {
                await InteractiveClient.Reconnect(Program.interactiveClient);
            } while (!await Program.interactiveClient.Ready());

            System.Console.WriteLine("Reconnection successful");
        }
Example #17
0
 private static void _client_OnClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     // the connection was closed, decide what you want to do here
     OutputConsole.WriteLine($"Socket Closed reason: {reason}", ConsoleColor.Red);
 }
Example #18
0
 private void ChatClient_DisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
 {
     this.AddChatMessage(new ChatMessage("ERROR", "DISCONNECTED FROM CHAT"));
 }
Example #19
0
        private async void RemoteService_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            this.RemoteEventsTextBlock.Text += "Disconnection occurred, attempting reconnection..." + Environment.NewLine;

            await this.DisconnectRemote();
        }
Example #20
0
 public override System.Threading.Tasks.Task CloseOutputAsync(System.Net.WebSockets.WebSocketCloseStatus closeStatus, string statusDescription, System.Threading.CancellationToken cancellationToken)
 {
     throw null;
 }
Example #21
0
 private void _webSocket_OnClosed(object sender, System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     OnConnectionClosed?.Invoke(this, System.EventArgs.Empty);
 }
 private void Socket_OnClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     WriteLog($"Closed: {reason.ToString()}");
 }
Example #23
0
 /// <summary>
 /// Asynchronously attempts to disconnect from the gateway
 /// </summary>
 /// <returns></returns>
 public async Task <StatusCodes.DisconnectStatus> DisconnectAsync(
     System.Net.WebSockets.WebSocketCloseStatus closeStatus = System.Net.WebSockets.WebSocketCloseStatus.NormalClosure)
 {
     return(await Connector.DisconnectAsync(closeStatus));
 }
Example #24
0
 private static void Chat_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
 {
     System.Console.WriteLine("DISCONNECTED");
 }
Example #25
0
 public override System.Threading.Tasks.Task CloseAsync(System.Net.WebSockets.WebSocketCloseStatus closeStatus, string statusDescription, System.Threading.CancellationToken cancellationToken)
 {
     return(default(System.Threading.Tasks.Task));
 }
Example #26
0
 private static void Program_OnClosed(object sender, System.Net.WebSockets.WebSocketCloseStatus reason)
 {
     PureWebSocket ws = sender as PureWebSocket;
     Console.WriteLine($@"{ws.InstanceName}: Closed {reason}");
 }
Example #27
0
 public abstract System.Threading.Tasks.Task CloseOutputAsync(System.Net.WebSockets.WebSocketCloseStatus closeStatus, string?statusDescription, System.Threading.CancellationToken cancellationToken);
Example #28
0
        private static async void InteractiveClient_OnDisconnectOccurred(object sender, System.Net.WebSockets.WebSocketCloseStatus e)
        {
            try
            {
                System.Console.WriteLine("Disconnection Occurred, attempting reconnection...");

                do
                {
                    await Program.interactiveClient.Disconnect();

                    await Task.Delay(2500);
                }while (!await Program.interactiveClient.Connect() && !await Program.interactiveClient.Ready());

                System.Console.WriteLine("Reconnection successful");
            }
            catch (Exception ex) { System.Console.WriteLine(ex.ToString()); }
        }