Replication across multiple peer

Hi, I am trying to build a replication system among multiple devices using MultipeerConnectivity framework by Apple and the Peer-to-Peer functionality offered by the Enterprise edition of Couchbase Lite.
I was able to replicate data between two devices, using Active and Passive peer or using 2 Active Peers.
But when I try to add another device in the session the replicator crashes and I am not able to replicate data anymore.
Is it possible to replicate data among many devices, or I need that one device is only connected to another one, creating a chain device after device?

I link an issue that I opened on GitHub if you need more context:

Yes, multi-way P2P is supported. What you’re running into looks like a bug in your code. More discussion on Github.

Thank you for the answer.

How should I setup the connection scheme to avoid message overhead?
I got this:
Device A(ActivePeer) -> DeviceB(PassivePeer) and it works.

Then i don’t know how insert the Device C.
Can I make a Device A(ActivePeer) -> Device C(PassivePeer) or I have to DeviceB(Active)-> DeviceC(Passive)
PS: my replicator is Push and Pull and continuous.

I did not clearly understand if a Peer can be Active and Passive simultaneously, or if I can use only ActivePeers.

Are there any update example of this Multipeer replication push and pull? I only found Photo-Drop but the code is about 5 years old.

I wrote more in github.

Just set up pairwise replications between two peers. As long as all peers are transitively connected, it’ll work.

As for active/passive, think of it as edge types in a directed graph. An active pull is an edge pointing towards you, an active push is an arrow pointing away from you. Both active forms a bidirectional edge. Data will flow through the system in the direction of the arrows.

In practice, it’s sufficient to have each node using active push for each replication. Or you could use active pull for each.

In a small mesh you can have each peer connecting to each other peer. (Although if A connects to B, then B doesn’t need to connect to A of course.) But the overhead grows as O(n^2) so this will scale badly for larger groups. For the size of group you can get with MPC it should be fine.

So in a group chat where all devices have an identical history can I only use devices that are transitively connected (A<->B<->C) or a star with a PassivePeer in the middle acting like a sever and other devices connected to it like clients?

Wrote also on Github.

Either of those will work. The star will have lower latency due to fewer hops, but puts more work on the central node.

It’s not too hard to reason about how this will work. Just draw a diagram with arrows and look at how the data will flow into or out of a node. Any topology where data can flow to all nodes will work.