tl;dr - See here for inspiration.
Long Winded Version -
https://thali.codeplex.com is my day job and it's all about building a P2P infrastructure on top of Couchbase-Lite.
Here is the file that implements our core listener.
So that's the good news.
The bad news is that we aren't using standard CouchBase Lite. We need a bunch of extra features that aren't in Couchbase Lite to make our P2P environment work correctly. So if you look
here you will see we've forked all of CouchBase's depots and built our own custom versions. We've filed all our features/bug fixes with CouchBase but they are really busy getting out V1 and haven't had
time to deal with them.
So unfortunately the code in the previous link is using a bunch of features we introduced that aren't in mainline CouchBase lite. So that link may not be the best example if you are just looking for generic CouchBase. Sorry. :(
If you are interested in what features we added and why see our architecture overview available
here.
I realize this is a ton of data to drop on your head and certainly not a quickly friendly - here you go. Hopefully your P2P needs are more modest than ours and you won't need all this. But if you do, at least you know it's there and can look at it, or better
yet, use it! It's all licensed under Apache 2.0.
I'd love to know what you're up to with P2P and CouchBase-Lite. Would you care to share more about what you are up to?
Thanks,
Yaron