public SocketChangeTracker(ChangeTrackerOptions options) : base(options)
        {
            if (options.Mode == ChangeTrackerMode.LongPoll)
            {
                Continuous = true;
            }

            tokenSource               = new CancellationTokenSource();
            _responseLogic            = ChangeTrackerResponseLogicFactory.CreateLogic(this);
            _responseLogic.OnCaughtUp = () =>
            {
                Client?.ChangeTrackerCaughtUp(this);
                _caughtUp = true;
            };

            _responseLogic.OnChangeFound = (change) =>
            {
                if (!ReceivedChange(change))
                {
                    Log.To.ChangeTracker.W(Tag, "Received unparseable change from server {0}", new LogJsonString(change));
                }
            };

            _responseLogic.OnFinished = RetryOrStopIfNecessary;
        }
Exemplo n.º 2
0
 public static ChangeTracker Create(ChangeTrackerOptions options)
 {
     if (options.Mode == ChangeTrackerMode.WebSocket)
     {
         return(new WebSocketChangeTracker(options));
     }
     else
     {
         return(new SocketChangeTracker(options));
     }
 }
Exemplo n.º 3
0
 protected ChangeTracker(ChangeTrackerOptions options)
 {
     options.Validate();
     Backoff           = new ChangeTrackerBackoff(options.RetryStrategy);
     DatabaseUrl       = options.DatabaseUri;
     Client            = options.Client;
     Mode              = options.Mode;
     Heartbeat         = DefaultHeartbeat;
     _includeConflicts = options.IncludeConflicts;
     LastSequenceId    = options.LastSequenceID;
     _workExecutor     = options.WorkExecutor ?? new TaskFactory(new SingleTaskThreadpoolScheduler());
     _remoteSession    = options.RemoteSession;
     _usePost          = options.UsePost;
 }
 public WebSocketChangeTracker(ChangeTrackerOptions options) : base(options)
 {
     _responseLogic = new WebSocketLogic();
     CanConnect     = true;
 }
 public WebSocketChangeTracker(ChangeTrackerOptions options) : base(options)
 {
     CanConnect = true;
 }