Exemple #1
0
        public async Task DisconnectAsync()
        {
            _isDisconnecting = true;

            if (_connection != null && _connection.IsConnected)
            {
                await _connection.Close();
            }
        }
Exemple #2
0
        private async Task Disconnect()
        {
            _isDisconnecting = true;

            if (_slackConnection != null && _slackConnection.IsConnected)
            {
                await _slackConnection.Close();
            }
        }
Exemple #3
0
        public void Disconnect()
        {
            _isDisconnecting = true;

            if (_connection != null && _connection.IsConnected)
            {
                _connection
                .Close()
                .GetAwaiter()
                .GetResult();
            }
        }
Exemple #4
0
        private void Disconnected()
        {
            Log.Information("Disconnected");

            RemoveEvents();
            try
            {
                _connection.Close().Wait();
            }
            catch (Exception e)
            {
                Log.Warning("SlackService Ensure disconnected: " + e.Message);
            }
            Log.Information("Trying to reconnect.");
            Connect().ContinueWith(x =>
            {
                if (x.Exception != null)
                {
                    Log.Error(x.Exception.Message, x.Exception);
                }
            });
        }
Exemple #5
0
 public virtual void Dispose()
 {
     Task.Run(() => SlackConnection.Close())
     .GetAwaiter()
     .GetResult();
 }
Exemple #6
0
 public async Task Close()
 {
     await connection.Close();
 }
Exemple #7
0
        public override async Task StopAsync()
        {
            await Connection.Close();

            await base.StopAsync();
        }
Exemple #8
0
 public async Task Disconnect()
 {
     _connection.OnDisconnect -= HandleDisconnect;
     await _connection.Close();
 }
Exemple #9
0
 public async Task StopAsync(CancellationToken cancellationToken)
 {
     _connection.OnMessageReceived -= ConnectionOnOnMessageReceived;
     _connection.OnDisconnect      -= ConnectionOnOnDisconnect;
     await _connection.Close();
 }