Exemplo n.º 1
0
        public async void Disconnect()
        {
            try
            {
                string str = await Logout(SessionToken).ConfigureAwait(false);
            }
            catch
            {
            }
            if (!RtmpClient.IsDisconnected)
            {
                try
                {
                    RtmpClient.Close();
                }
                catch (Exception ex)
                {
                    Tools.Log(ex.Message);
                    Tools.Log(ex.StackTrace);
                }
            }
            HeartbeatCount = 0;
            Timer heartbeatTimer = _heartbeatTimer;

            if (heartbeatTimer != null)
            {
                heartbeatTimer.Stop();
            }
            IsConnected = false;

            OnDisconnect?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public void Disconnect()
        {
            _client.Disconnected    -= _backupDisconnected;
            _client.MessageReceived -= _backupHandler;

            if (!_client.IsDisconnected)
            {
                _client.Close();
            }

            _auth           = false;
            _heartbeatCount = 0;
            if (_heartbeatTimer != null)
            {
                _heartbeatTimer.Stop();
            }
        }