Hi everybody,

I would like to sync my devices in p2p using the phonegap plugin on Android 
devices. I shouldn't have more than 10 devices and the LAN should be stable.

1. I'm thinking to make one device as a master and, if possible, take the 
role of the sync gateway. 
What do you think about that ?


2. For the moment, I'm not using any discovery service but instead, just 
setting the IP addresses manually in the source code. If I'm using the 
architecture with one master device as a star, do my devices need to know 
only the IP address of my master device? Or the master device need as well 
the IP address of the other remote devices in order to replicate any change 
on the database?


3. I tried a really simple example doing a p2p replication. It's working 
quite well when I provide both IP addresses. When I provide the IP address 
of my device A to my device B, the device A can make any change and the 
data is replicated well but it's not working in the other way, so from the 
device B to A. 

I'm using this function to make the replication with the same URL, the 
device's A one to both devices (probably why it's not working...)

function triggerSync(cb, retryCount) {

if (!config.user) {
       return log("no user")
   }
 
console.log("window.config.site.syncUrl " + window.config.site.syncUrl);
var remote = {
url : window.config.site.syncUrl
},
push = {
source : appDbName,
target : remote,
continuous : true
}, pull = {
target : appDbName,
source : remote,
continuous : true
};

pushSync = syncManager(window.config.site.server, push);
pullSync = syncManager(window.config.site.server, pull);

...
}


The logs, when it is not working : 

04-16 11:31:25.023: I/CBLSQL(749): Acme.Utils.ThreadPool(0)-PooledThread: 
Acme.Serve.Serve$ServeConnection@4221c580 Begin transaction (level 1)
04-16 11:31:25.023: I/CBLSQL(749): Acme.Utils.ThreadPool(0)-PooledThread: 
Acme.Serve.Serve$ServeConnection@4221c580 Begin transaction (level 2)
04-16 11:31:25.033: I/CBLSQL(749): Acme.Utils.ThreadPool(0)-PooledThread: 
Acme.Serve.Serve$ServeConnection@4221c580 CANCEL transaction (level 2)
04-16 11:31:25.033: W/System.err(749): 
com.couchbase.lite.CouchbaseLiteException: No existing revision found with 
doc id: 4237ce67-922b-46a9-9d5d-54f0c6504cc5
04-16 11:31:25.033: W/System.err(749): at 
com.couchbase.lite.Database.putRevision(Database.java:2981)
04-16 11:31:25.033: W/System.err(749): at 
com.couchbase.lite.Database.putRevision(Database.java:2916)
04-16 11:31:25.043: W/System.err(749): at 
com.couchbase.lite.router.Router.update(Router.java:1453)
04-16 11:31:25.043: W/System.err(749): at 
com.couchbase.lite.router.Router.do_POST_Document_bulk_docs(Router.java:904)
04-16 11:31:25.043: W/System.err(749): at 
java.lang.reflect.Method.invokeNative(Native Method)
04-16 11:31:25.043: W/System.err(749): at 
java.lang.reflect.Method.invoke(Method.java:515)
04-16 11:31:25.043: W/System.err(749): at 
com.couchbase.lite.router.Router.start(Router.java:443)
04-16 11:31:25.043: W/System.err(749): at 
com.couchbase.lite.listener.LiteServlet.service(LiteServlet.java:102)
04-16 11:31:25.043: W/System.err(749): at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
04-16 11:31:25.043: W/System.err(749): at 
Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2251)
04-16 11:31:25.053: W/System.err(749): at 
Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2176)
04-16 11:31:25.053: W/System.err(749): at 
Acme.Serve.Serve$ServeConnection.run(Serve.java:1988)
04-16 11:31:25.053: W/System.err(749): at 
Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1223)
04-16 11:31:25.053: W/System.err(749): at 
java.lang.Thread.run(Thread.java:841)
04-16 11:31:25.053: E/Database(749): 
com.couchbase.lite.CouchbaseLiteException: No existing revision found with 
doc id: 4237ce67-922b-46a9-9d5d-54f0c6504cc5



3. Any clues why is acting like that and how to do it properly?

3. Using phonegap, if i want to discover the other peers, how would you do 
that? 
I was thinking to make a plugin doing that in native language on Android 
and iOS, using for instance Bonjour service.

Thank you in advance for your help,

Bart

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/1c4d72b5-a58e-41b7-bd55-bc43c40538b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to