Esempio n. 1
0
 private void Disconnect()
 {
     Log("disconnecting...");
     this.ConnectionState = UserStreamsConnectionState.Disconnected;
     this.CleanupConnection();
     Log("successfully disconnected.");
 }
Esempio n. 2
0
        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();
                }
            }));
        }
Esempio n. 3
0
        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();
            }));
        }
Esempio n. 4
0
 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();
                       }
                   }));
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 private void Disconnect()
 {
     Log("disconnecting...");
     this.ConnectionState = UserStreamsConnectionState.Disconnected;
     this.CleanupConnection();
     Log("successfully disconnected.");
 }
 internal void UpdateConnectionState()
 {
     ConnectionState = ReceiveManager.GetConnectionState(Account.Id);
 }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
 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;
 }