本文整理汇总了C#中Couchbase.Lite.Database.CreatePushReplication方法的典型用法代码示例。如果您正苦于以下问题:C# Database.CreatePushReplication方法的具体用法?C# Database.CreatePushReplication怎么用?C# Database.CreatePushReplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Lite.Database
的用法示例。
在下文中一共展示了Database.CreatePushReplication方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
private IEnumerator Start () {
Debug.LogFormat ("Data path = {0}", Application.persistentDataPath);
#if UNITY_EDITOR_WIN
Log.SetLogger(new UnityLogger());
#endif
_db = Manager.SharedInstance.GetDatabase ("spaceshooter");
_pull = _db.CreatePullReplication (GameController.SYNC_URL);
_pull.Continuous = true;
_pull.Start ();
while (_pull != null && _pull.Status == ReplicationStatus.Active) {
yield return new WaitForSeconds(0.5f);
}
var doc = _db.GetExistingDocument ("player_data");
if (doc != null) {
//We have a record! Get the ship data, if possible.
string assetName = String.Empty;
if(doc.UserProperties.ContainsKey("ship_data")) {
assetName = doc.UserProperties ["ship_data"] as String;
}
StartCoroutine(LoadAsset (assetName));
} else {
//Create a new record
doc = _db.GetDocument("player_data");
doc.PutProperties(new Dictionary<string, object> { { "ship_data", String.Empty } });
}
doc.Change += DocumentChanged;
_push = _db.CreatePushReplication (new Uri ("http://127.0.0.1:4984/spaceshooter"));
_push.Start();
}
示例2: CreateReplication
private Replication CreateReplication(Database db, bool push)
{
Replication repl = null;
if (push) {
repl = db.CreatePushReplication(_listenerDBUri);
} else {
repl = db.CreatePullReplication(_listenerDBUri);
}
#if USE_AUTH
repl.Authenticator = new DigestAuthenticator("bob", "slack");
#endif
return repl;
}
示例3: CreateReplication
private Replication CreateReplication(Database db, bool push)
{
Replication repl = null;
if (push) {
repl = db.CreatePushReplication(_listenerDBUri);
} else {
repl = db.CreatePullReplication(_listenerDBUri);
}
if (_authScheme == AuthenticationSchemes.Basic) {
repl.Authenticator = new BasicAuthenticator("bob", "slack");
} else if (_authScheme == AuthenticationSchemes.Digest) {
repl.Authenticator = new DigestAuthenticator("bob", "slack");
}
return repl;
}