Couchbase lite 2.0, How to start the replicator from Db21 to DB22?


#1

Hi,

Another topic about how to make it work since the DB22.
I’m always en Xamarin forms, c#.

With the db21, I used to connect my replicator like that :

  Uri target = new Uri($"blip://{_serverInfo.UrlServer}");
		ReplicatorConfiguration replicationConfig = new ReplicatorConfiguration(_dataBaseGetter.Get(), target);
		replicationConfig.Continuous = true;
		replicationConfig.ReplicatorType = ReplicatorType.PushAndPull;
		replicationConfig.Authenticator = new BasicAuthenticator(_serverInfo.Login, _serverInfo.Password);
		_replicator = new Replicator(replicationConfig);

Sice the DB22, I can’t call the ReplicatorConfiguration with an URI, but an IEndPoint object.

So I search a little and do it like that with the DB22 :

Uri target = new Uri($"blip://{_serverInfo.UrlServer}");
		IEndpoint endpoint = new URLEndpoint(target);
		ReplicatorConfiguration replicationConfig = new ReplicatorConfiguration(_dataBaseGetter.Get(), endpoint)
		{
			Continuous = true,
			ReplicatorType = ReplicatorType.PushAndPull,
			Authenticator = new BasicAuthenticator(_serverInfo.Login, _serverInfo.Password)
		};
		_replicator = new Replicator(replicationConfig); 

In the 2 cases, after creating my _replicator, I’m doing that :

if (CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected)
			_replicator.Start();
		_token = _replicator.AddChangeListener(_replicator_StatusChanged); 

But my replicator did not start anymore.

How to do it ?

Steeve


#2

Hi,

I’m answering myself, I did miss to change blip to ws …, It’s in the change log.

Now the replicator try to connect, but never connect.

I’ve to related questions :
As I didn’t change sync gateway to the 2.0 beta version (It’ my next task to do), will my replicator be able to connect ?
Do I need to change something in the sync gateway config file ?

Regards,

Steeve


#3

As mentioned in the announcement, you will have to update your Sync Gateway to 2.0 . DB022 clients will not sync with older versions of SGW.

Nothing needs to change in your SGW config file