Exemple #1
0
        private async Task <bool> ReconnectWithAuth()
        {
            if (m_state == ChatState.Disconnected)
            {
                return(false);
            }
            UpdateStatus(ChatState.ConnectingWithAuth);

            // Disconnect the current socket.
            await m_ws.Disconnect();

            m_ws = null;

            Logger.Info($"Reconnecting to channel {m_channelId} WITH AUTH.");

            // Connect with auth
            if (!(await ConnectInternal(true)))
            {
                // If we fail, fire disconnected.
                await Disconnect();

                return(false);
            }

            UpdateStatus(ChatState.ConnectedWithAuth);
            return(true);
        }
Exemple #2
0
        public async Task Disconnect()
        {
            UpdateStatus(ChatState.Disconnected, false);
            SimpleWebySocket ws = m_ws;

            if (ws != null)
            {
                await ws.Disconnect();
            }
            m_callback = null;
        }