The P2P talk 
<http://connect15.couchbase.com/agenda/couchbase-mobile-103-building-peer-peer-app-couchbase-mobile/>
 I co-presented at Couchbase Connect gave me the chance to finally sit down and 
write a P2P mesh replication demo for iOS. This is something people often ask 
about here, and I wave my hands and go “blah blah Listener blah blah Bonjour”, 
but it’s nontrivial to actually implement.

I built it as an extension of Grocery Sync, on a “bonjour-sync 
<https://github.com/couchbaselabs/Grocery-Sync-iOS/tree/bonjour-sync>” branch, 
but the P2P code 
<https://github.com/couchbaselabs/Grocery-Sync-iOS/tree/bonjour-sync/Source/PeerSync>
 is modular enough that it can be dropped into other iOS or Mac apps. 

The user model is that you pop open a browser that lists the other devices on 
the LAN running the app, and can choose people to follow (i.e. pull from). That 
setting is saved persistently, and from then on any time one of those devices 
is online and has new changes, your app will pull the changes across to you.

As part of building this I found some limitations in Couchbase Lite; for 
example, SSL cert hostname validation makes it infeasible to use P2P SSL 
connections. I filed issues and I’ve started putting in some fixes (although 
not in time for version 1.1.)

My code is for iOS or Mac OS, but in the session I described the techniques in 
a cross-platform way. And Android supports Bonjour (under a different 
non-trademarked name) so the platforms should be able to interoperate.

—Jens

PS: The talk also featured Pasin’s photo-sharing app, which he’s announced 
previously <http://blog.couchbase.com/photodrop>  It’s also very cool, and 
shows off a completely different technique: using QR code generation & scanning 
to let two devices securely ‘pair’ and connect to each other.

-- 
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/C00D5C64-0343-4CE1-9B7F-8E87E34FC909%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to