private void Disconnect() { Log("disconnecting..."); this.ConnectionState = UserStreamsConnectionState.Disconnected; this.CleanupConnection(); Log("successfully disconnected."); }
private void RaiseDisconnectedByError(string header, string detail) { this.CleanupConnection(); Debug.WriteLine("*** USER STREAM DISCONNECT ***" + Environment.NewLine + header + Environment.NewLine + detail + Environment.NewLine); var discone = new UserStreamsDisconnectedEvent(this.Account, header + " - " + detail); BackstageModel.RegisterEvent(discone); this.ConnectionState = UserStreamsConnectionState.WaitForReconnection; this._currentConnection.Add( Observable.Timer(TimeSpan.FromMinutes(5)) .Do(_ => BackstageModel.RemoveEvent(discone)) .Subscribe(_ => { if (this.ConnectionState == UserStreamsConnectionState.WaitForReconnection) { this.Reconnect(); } })); }
private IDisposable ConnectCore() { this.CheckDisposed(); this.ConnectionState = UserStreamsConnectionState.Connecting; Log("starting connection..."); var isConnectionActive = true; var con = this.Account.ConnectUserStreams(this._trackKeywords, this.Account.ReceiveRepliesAll, this.Account.ReceiveFollowingsActivity) .Do(_ => { if (this.ConnectionState != UserStreamsConnectionState.Connecting) { return; } this.ConnectionState = UserStreamsConnectionState.Connected; this.ResetErrorParams(); Log("successfully connected."); }) .SubscribeWithHandler(new HandleStreams(this), ex => { if (isConnectionActive) { this.HandleException(ex); } }, () => { if (isConnectionActive) { this.Reconnect(); } }); _stateUpdater.UpdateState(); return(Disposable.Create(() => { isConnectionActive = false; con.Dispose(); })); }
private IDisposable ConnectCore() { this.CheckDisposed(); this.ConnectionState = UserStreamsConnectionState.Connecting; Log("starting connection..."); var con = this.Account.ConnectUserStreams(this._trackKeywords, this.Account.ReceiveRepliesAll, this.Account.ReceiveFollowingsActivity) .Do(_ => { if (this.ConnectionState != UserStreamsConnectionState.Connecting) return; this.ConnectionState = UserStreamsConnectionState.Connected; this.ResetErrorParams(); Log("successfully connected."); }) .SubscribeWithHandler(new HandleStreams(this), this.HandleException, this.Reconnect); _stateUpdater.UpdateState(); return con; }
internal void UpdateConnectionState() { ConnectionState = ReceiveManager.GetConnectionState(Account.Id); }
private IDisposable ConnectCore() { this.CheckDisposed(); this.ConnectionState = UserStreamsConnectionState.Connecting; var con = this.Account.ConnectUserStreams(this._trackKeywords, this.Account.IsReceiveRepliesAll) .Do(_ => { if (this.ConnectionState != UserStreamsConnectionState.Connecting) return; this.ConnectionState = UserStreamsConnectionState.Connected; this._currentBackOffMode = BackOffMode.None; }) .SubscribeWithHandler(new HandleStreams(this), this.HandleException, this.Reconnect); return con; }
private void Disconnect() { this.ConnectionState = UserStreamsConnectionState.Disconnected; this.CleanupConnection(); }
private IDisposable ConnectCore() { this.CheckDisposed(); this.ConnectionState = UserStreamsConnectionState.Connecting; Debug.WriteLine("*USERSTREAMS* " + _account.UnreliableScreenName + ": Starting connection..."); var con = this.Account.ConnectUserStreams(this._trackKeywords, this.Account.ReceiveRepliesAll, this.Account.ReceiveFollowingsActivity) .Do(_ => { if (this.ConnectionState != UserStreamsConnectionState.Connecting) return; this.ConnectionState = UserStreamsConnectionState.Connected; this._currentBackOffMode = BackOffMode.None; }) .SubscribeWithHandler(new HandleStreams(this), this.HandleException, this.Reconnect); return con; }