internal void Disconnect() { _intendedConnectionStatus = TweetStreamer.ConnectionStatus.Disconnected; _connection.Disconnect(); _messagePublisher.Disconnect(); }
void connection_ConnectionStatusChanged(object sender, IConnectionStatusChangedEventArgs args) { _actualConnectionStatus = args.Status; if (_intendedConnectionStatus == TweetStreamer.ConnectionStatus.Connected && _actualConnectionStatus == TweetStreamer.ConnectionStatus.Disconnected) { if (_connectionTimer != null) { _connectionTimer.Dispose(); _connectionTimer = null; } int milliSecondsToReconnect = GetSleepMilliSeconds(); _logger.Log(Kwwika.Logging.LogLevels.Info, "Connection", "Waiting {0} milliseconds before connecting.", milliSecondsToReconnect); _connectionTimer = new Timer(new TimerCallback((object state) => { _connection.Connect(); _connectionTimer = null; }), null, milliSecondsToReconnect, Timeout.Infinite); } if (args.Status == TweetStreamer.ConnectionStatus.Connected) { ResetSleepMilliSeconds(); } }
public void Connect() { _intendedConnectionStatus = TweetStreamer.ConnectionStatus.Connected; _connection.Connect(); this.SendIntialCountFieldValues(_config.SearchDefinitions); }