When one should go for sync gateway and couchbase server?

I have implemented replication between devices using CBLReplication “continuous push” and couchbase listener framework for my ios application between multiple devices . Have a question now, can i achieve the same using couchbase server and sync gateway.

when one should go for the below options for replication(to understand the design considerations) between devices?

1.Peertopeer replication using couchbase listener framework and CBLReplication object
2. Peertopeer replication using couchbase server and sync gateway

Though i have gone through some blogs and references, could not find the direct answer. Guiding me to some links or blogs also would be great.Thanks in advance.

1.Peertopeer replication using couchbase listener framework and CBLReplication object

Peer-to-peer replication between Couchbase Lite databases is used most of the time when devices are on the same LAN network with no internet connection. Or if you don’t want to synchronize the documents via a server (Sync Gateway).

  1. Peertopeer replication using couchbase server and sync gateway

Synchronizing documents to Couchbase Lite through Sync Gateway is a client-server architecture rather than peer-to-peer sync.

This is the most common way of synchronizing because it fits most use cases. Most apps that use Couchbase Mobile synchronize the documents between users through Sync Gateway. Couchbase Server is the backing server where the data is persisted.

Note that you can have both synchronization methods in your app: to sync via the server most of the time and run peer-to-peer replications if there are 2 or more devices running your app on the same network.

It’s also possible to run replications between Sync Gateway instances (https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/running-replications/index.html). This is generally used to scale across different data centres.

Thanks jamiltz. But i’m so confused with the following terms adhoc wifi, peer to peer wifi , device to device wifi and finally same LAN network with no internet connection? All behaves the same rite? if not, how to create this “same LAN network with no internet connection”?

For my ios application, we have tried out both multipeer connectivity framework and couchbase listener for replication between devices.There is one usecase,which is working with multipeerconnectivity framework alone. Details as follows,

Usecase: Four ipad devices were used.Only one device connected to infra wifi. For all other devices, I turned on wifi, but they are not connected to any network. Wifi symbol is also not shown on devices. Data is getting transferred with mulipeer framework, but with listener it says the device is offline and data is not getting transferred.Why this case is not working for listener framework?

I have also tried creating a adhoc network in iMac, connected the devices to the network, replication fails for this case also.

Please correct me if my understanding is not correct with peer-to-peer wifi.

Only if all the devices are connected to infra wifi, replication happens properly.