{"id":9501,"date":"2020-10-19T09:00:29","date_gmt":"2020-10-19T16:00:29","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=9501"},"modified":"2025-06-13T20:08:53","modified_gmt":"2025-06-14T03:08:53","slug":"peer-to-peer-database-sync-with-couchbase-lite","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/","title":{"rendered":"Peer-to-Peer Database Sync with Couchbase Lite"},"content":{"rendered":"<p><a href=\"https:\/\/www.couchbase.com\/blog\/announcing-couchbase-for-mobile-and-edge-computing\/\">Couchbase Lite 2.8 release<\/a> announced support for out-of-the-box, enterprise-grade peer-to-peer database sync solution. The new capability allows direct sync between Couchbase Lite enabled mobile and\/or non-mobile embedded apps without the need for a cloud-based control point.<\/p>\n<p>In this post, we provide an overview of the feature and we will demonstrate how easy it setup peer-to-peer sync between two clients. For more details, refer to the <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-landing-p2psync.html\">documentation<\/a> pages for platform-specific API and sample code snippets.<\/p>\n<p>First, some use cases \u2026<\/p>\n<h2 id=\"usecases\">Use Cases<\/h2>\n<p>App users in disconnected environments requiring the ability to collaborate with each other are candidates for peer-to-peer database sync.\u00a0Here are a few such examples &#8211;<\/p>\n<ul>\n<li><strong>Field Apps<\/strong> :<br \/>\nField workers at a construction site, volunteers at disaster recovery zone, miners, health care workers at mobile clinics can collaborate and coordinate tasks with each other over a local area network without any internet connectivity.<\/li>\n<li><strong>Travel<\/strong> :<br \/>\nFlight attendants taking meal order updates can update inventory information that is automatically synced to other attendants in-flight. That way, a flight attendant does not offer a meal after the last one has been offered.<\/li>\n<li><strong>Hospitality<\/strong> :<br \/>\nMeal ordering workflows in restaurants can be automated. Servers can take and send orders to the kitchen, check on order status, take payments, etc. from mobile devices without leaving the side of the customer\u2019s table.<\/li>\n<li><strong>Maritime<\/strong> :<br \/>\nCrew members aboard ships\/vessel can record and sync equipment metrics in real time with other crew members, allowing to make real time decisions<\/li>\n<\/ul>\n<h2 id=\"typicaldeployment\">Typical Deployment<\/h2>\n<p>Shown below is a typical deployment using Couchbase for peer-to-peer database sync in disconnected environments. A disconnected environment or the \u201cedge\u201d can operate autonomously without any connectivity to the backend cloud based servers. However, when there is internet connectivity, the changes from the disconnected edge can be <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/learn\/java-android-landing-replications.html\">synced<\/a> with the remote Couchbase server through the Sync Gateway.<\/p>\n<p>The Couchbase Lite clients can be organized in different topologies. It could be a star topology where one client can be designated as the primary control point or listener and the other clients can communicate with each other through the designated listener. Alternatively, clients can be organized in a connected mesh topology where every client is connected directly to every other client in the same network.<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-13-at-1.42.04-PM-e1602647543430.png\" alt=\"\" \/><\/figure>\n<h2 id=\"peer-to-peerworkflow\">Peer-to-Peer workflow<\/h2>\n<p>Peer-to-peer sync is Websockets based and works over IP-based networks. It is the same protocol that is used to sync with the remote Sync Gateway. Here is a high level workflow of peer-to-peer data sync with Couchbase Lite. Every participating peer takes the role of a <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/advance\/java-android-p2psync-websocket-using-passive.html\">\u201cPassive Peer\u201d<\/a> which is analogous to a server in a typical client-server communication and\/or an <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/advance\/java-android-p2psync-websocket-using-active.html\">\u201cActive Peer\u201d<\/a> which is analogous to a client in a typical client-server communication. An app can take on role of both an active and passive peer.<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/10\/peer-to-peer-couchbase-lite-walkthrough.png\" alt=\"\" \/><\/figure>\n<ol>\n<li>The <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.8.0\/couchbase-lite-swift\/Classes\/URLEndpointListener.html\">websockets listener<\/a> is initialized on the Passive Peer with the Couchbase Lite database to be synched. There are a number of configurable options available including the ability to specify port, network interface, TLSIdentity etc.<\/li>\n<li>One of the configurable options on the <code>Listener<\/code> is the authenticator callback function to be invoked when the listener receives credentials from the active peer. This <code>ListenerAuthenticator<\/code> callback function must be implemented by the app and includes logic to authenticate the client credentials.<\/li>\n<li>The Passive peer advertises it\u2019s services. This step is handled entirely within the app and Couchbase Lite does not play a role here. Typically, apps would leverage platform specific party frameworks such as <a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsnetservice\">NSNetService<\/a> for this purpose. In fact, depending on the deployment, this step may be optional. For instance, the device could be configured with a static IP Address or if there is DNS support, then the client could be listening on a well-known URL.<\/li>\n<li>The active peer or client browses for passive peers to connect to. Again, this step is handled entirely within the app and Couchbase Lite does not play a role here. Typically, apps would leverage platform specific party frameworks such as <a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsnetservice\">NSNetService<\/a> for this purpose. Of course, if the <code>Listener<\/code> is listening on a well-known address, then this step would be optional.<\/li>\n<li>Once the active peer identifies the peer to connect to, it needs to establish a replication connection to the other endpoint. The replicator for peer-to-peer sync is configured exactly the same way as would be the case if it were establishing the connection to remote Sync Gateway.<\/li>\n<li>As part of the TLS handshake of the connection establishment, the server certs are authenticated. This happens transparently to the app.<\/li>\n<li>Once server cert is authenticated, the client credentials are sent to the listener for authentication. Couchbase Lite supports both basic authentication and client cert based <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-p2psync-websocket.html#using-tls\">authentication<\/a>.<\/li>\n<li>The incoming credentials are sent to the registered <code>ListenerAuthenticator<\/code> where they are validated. Once authenticated, the communication channel is established between the peers.<\/li>\n<li>Thereafter, everytime there is a document change in the database, the data change is automatically synced over to the other end. The direction of data transfer is configurable to be one-way or bidirectional.<\/li>\n<\/ol>\n<h2 id=\"attributesofthesynctechnology\">Attributes of the Sync Technology<\/h2>\n<p>Doing sync correctly is difficult. There are several considerations and here is a cheat sheet of how peer-to-peer sync stacks up. Refer to the <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-landing-p2psync.html\">documentation<\/a> for details<\/p>\n<table>\n<colgroup>\n<col style=\"text-align: left\" \/>\n<col style=\"text-align: left\" \/> <\/colgroup>\n<thead>\n<tr>\n<th style=\"text-align: left\">Feature<\/th>\n<th style=\"text-align: left\">Couchbase Lite Peer-to-Peer Sync<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left\">Security<\/td>\n<td style=\"text-align: left\">Out-of-box support for TLS encryption. Cert-based authentication. Basic Auth. Apps have to write 0 lines of code to get TLS encryption<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Network Resiliency<\/td>\n<td style=\"text-align: left\">Retries with exponential back off. Continuous replications retry indefinitely while one-shot replications give up after certain number of attempts<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Efficiency<\/td>\n<td style=\"text-align: left\">Using Delta Sync technlogy, optimize data transfer costs by only syncing parts of document that have changed<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Data Conflicts<\/td>\n<td style=\"text-align: left\">Built-in. By default, conflicts are automatically resolved using predefined policies. In addition, Apps have flexibilty to specify own custom 2-way merge functions to deal with conflicts<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Developer Ease of Use<\/td>\n<td style=\"text-align: left\">It takes just a few lines of code to get peer-to-peer sync going. Of course, there are a number of configurable options to customize it per your needs<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Multi-platform Support<\/td>\n<td style=\"text-align: left\">Couchbase Lite is supported on a number of mobile and non-mobile platforms. The peer-to-peer data sync functionality enables sync between heterogenous platforms &#8211; for instance between an Android and iOS app<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Flexible Topologies<\/td>\n<td style=\"text-align: left\">Since every participating peer can act as either a Listener or Replicator or both, Couchbase Lite clients participating in peer-to-peer sync can be organized in different topologies such as star, mesh etc. The choice depends on the needs of the app<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"gettingstartedcode\">Getting Started Code<\/h2>\n<p>You can check out our <a href=\"https:\/\/docs.couchbase.com\/tutorials\/index.html\">tutorials pages<\/a> for a complete app demonstrating the peer-to-peer sync capabiities. But here, I\u2019d like to hare the minimal code required to get sync going so you can see for yourself how easy it is to get the previously described workflow going. Although the snippets are for iOS, it should be straightforward to map it to any other Couchbase Lite platform.<\/p>\n<h3 id=\"passivepeer\">Passive Peer<\/h3>\n<p>The following code snippet initializes the listener on the Passive Peer that listens for incoming peer connections<\/p>\n<pre class=\"lang:swift decode:true \"><code>\r\n\/\/ 1: Initialize Listener Configuration with the Couchbase Lite database to be synced\r\nlet listenerConfig = URLEndpointListenerConfiguration(database: db)\r\n\r\n\/\/ 2: Attach authenticator to be used to validate client credentials. \r\n\/\/ In this sample, I have attached an authenticator for validating basic auth credentials \r\nlistenerConfig.authenticator = ListenerPasswordAuthenticator.init { (username, password) -&gt; Bool in \r\nif (self._allowlistedUsers.contains([\"password\" : password, \"name\":username])) { \r\n    return true \r\n  }\r\n return false\r\n}\r\n\r\n\/\/ Optionally, override other config options such as delta sync, TLSIdentity of the server etc.\r\n\/\/ By default, the listener is configured with a self signed cert that is generated by Couchbase LIte \r\n\/\/ This cert is referred to as \"anonymous self signed cert\"\r\n\r\n\/\/ 3: Initialize Listener with the Listener Configuration \r\n_websocketListener = URLEndpointListener(config: listenerConfig)\r\n\r\n\r\n\/\/ 4: Start the Listener. The listener is now listening for incoming connections \r\ntry? websocketListener.start()\r\n\r\n<\/code><\/pre>\n<h3 id=\"activepeer\">Active Peer<\/h3>\n<p>The following code snippet initializes the replicator for <em>secure<\/em> peer-to-peer sync. It\u2019s the same replicator logic used when replicating to remote endpoint<\/p>\n<pre class=\"lang:swift decode:true \"><code>\r\n\/\/ 1: Initialize Replicator Configuration with the Couchbase Lite database to be synced \r\n\/\/ and the URL endpoint corresponding to the websockets listener\r\nlet config = ReplicatorConfiguration.init(database: userDb, target: URLEndpoint.init(url:targetUrl))\r\n\r\n\/\/ 2: Set up authenticator with client credentials. In this case, we are using basic auth\r\nlet authenticator = BasicAuthenticator(username: user, password: password) \r\nconfig.authenticator = authenticator\r\n\r\n\/\/ Optionally, set other config options such as replication mode, conflict resolver etc\r\n\/\/ 3: Initialize replicator with the replicator configuration \r\nreplicatorForUserDb = Replicator.init(config: config)\r\n\r\n\/\/ 4: Set up replicator to only accept self signed certificate for server\/listener\r\n\/\/ This is because we are using the default TLSIdentity on listener side which corresponds to \r\n\/\/ anonymous self signed cert config.acceptOnlySelfSignedServerCertificate = true\r\n\r\n\/\/ 5: Start the replication \r\nreplicatorForUserDb?.start()\r\n<\/code><\/pre>\n<p>That\u2019s it! In just a few simple steps, you can get secure peer-to-peer sync going with Couchbase Lite<\/p>\n<h2 id=\"whataboutpeer-to-peersyncin2.1\">What about Peer-to-Peer Sync in 2.1 ?<\/h2>\n<p>If you have been working with Couchbase Lite, you are probably familiar with the <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.8\/swift\/learn\/swift-p2psync-custom.html\">peer-to-peer sync functionality<\/a> that was introduced in <a href=\"https:\/\/www.couchbase.com\/blog\/announcing-general-availability-couchbase-mobile-2-1\/\">2.1 release<\/a> of Couchbase Lite. In the 2.1 release, we provided an <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.8.0\/couchbase-lite-swift\/Protocols\/MessageEndpointConnection.html\">MessageEndpointConnection <\/a>interface definition that had to be implemented by the app. Couchbase Lite replicator communicated with the app through this interface, providing the data changes that had to be synced. How to data got transferred to the receiving peer was completely upto the app. Providing an interface offered the flexibility for app developers to use any communications framework of choice and could be used across any transport (IP or non-IP).<\/p>\n<p>In 2.8 we have vastly simplified the task by providing an out-of-box implementation for peer-to-peer sync over IP networks. As you\u2019ll see shortly, it just takes a few lines of code to get going. The <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.8.0\/couchbase-lite-swift\/Protocols\/MessageEndpointConnection.html\">MessageEndpointConnection<\/a> interface continues to remain supported. So if you have already implemented your sync solution with what was offered in 2.1, you are not required to migrate your solution to use the new API. In fact, that still remains your only option if you are syncing over non-IP based networks. \u00a0However, if you are syncing over IP networks, it would be encouraged as it would greatly simplify your app code and reduce testing and maintenance costs.<\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"whatnext\">What Next<\/h2>\n<p>Couchbase is the only peer-to-peer database sync solution that allows clients to directly communicate with each other in disconnected environments.<\/p>\n<p>You can <a href=\"https:\/\/www.couchbase.com\/downloads?family=couchbase-lite\">download Couchbase Lite<\/a> and evauate the functionality for free.<\/p>\n<p>If you want to dive into the details, here\u2019s where you can find more information<br \/>\n&#8211; <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.8\/swift\/learn\/swift-landing-p2psync.html\">Documentation: Peer-to-Peer <\/a><br \/>\n&#8211; <a href=\"https:\/\/docs.couchbase.com\/tutorials\/cbl-p2p-sync-websockets\/swift\/cbl-p2p-sync-websockets.html\">Tutorials: Peer-to-Peer<\/a><br \/>\n&#8211; <a href=\"https:\/\/www.couchbase.com\/solutions\/peer-to-peer\/\">Solutions Page: Peer-to-Peer Solutions<\/a><br \/>\n&#8211; <a href=\"https:\/\/connectonline.influitive.com\/forum\/t\/peer-to-peer-sync-with-couchbase-lite\/260\">Connect Video with Demo: Peer-to-Peer Sync using Couchbase Lite<\/a><\/p>\n<p>The <a href=\"https:\/\/www.couchbase.com\/forums\/\">Couchbase Forums<\/a> is a great place to reach out with questions. Please leave a comment below or feel free to reach out to me via <a href=\"https:\/\/twitter.com\/rajagp\">Twitter<\/a>\u00a0or <a href=\"mailto:priya.rajagopal@couchbase.com\">email me<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Couchbase Lite 2.8 release announced support for out-of-the-box, enterprise-grade peer-to-peer database sync solution. The new capability allows direct sync between Couchbase Lite enabled mobile and\/or non-mobile embedded apps without the need for a cloud-based control point. In this post, we [&hellip;]<\/p>\n","protected":false},"author":1423,"featured_media":9502,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2370,1815,1821,7667,1810,7666,2389,9409,2351],"tags":[2358,1536,1909],"ppma_author":[8948],"class_list":["post-9501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-best-practices-and-tutorials","category-couchbase-architecture","category-couchbase-lite","category-couchbase-mobile","category-edge-computing","category-solutions","category-swift","category-xamarin","tag-couchbase-mobile-2-x","tag-ios","tag-swift"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Peer-to-Peer Database Sync with Couchbase Lite - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"Couchbase Lite&#039;s enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Peer-to-Peer Database Sync with Couchbase Lite\" \/>\n<meta property=\"og:description\" content=\"Couchbase Lite&#039;s enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-19T16:00:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:08:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/Peer-to-Peer-Database-Sync-with-Couchbase-Lite.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/Peer-to-Peer-Database-Sync-with-Couchbase-Lite.png\" \/>\n<meta name=\"twitter:creator\" content=\"@rajagp\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\"},\"author\":{\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c\"},\"headline\":\"Peer-to-Peer Database Sync with Couchbase Lite\",\"datePublished\":\"2020-10-19T16:00:29+00:00\",\"dateModified\":\"2025-06-14T03:08:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\"},\"wordCount\":1508,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg\",\"keywords\":[\"couchbase mobile 2.x\",\"ios\",\"swift\"],\"articleSection\":[\"Android\",\"Best Practices and Tutorials\",\"Couchbase Architecture\",\"Couchbase Lite\",\"Couchbase Mobile\",\"Edge computing\",\"Solutions\",\"Swift\",\"Xamarin\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\",\"name\":\"Peer-to-Peer Database Sync with Couchbase Lite - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg\",\"datePublished\":\"2020-10-19T16:00:29+00:00\",\"dateModified\":\"2025-06-14T03:08:53+00:00\",\"description\":\"Couchbase Lite's enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg\",\"width\":1200,\"height\":628,\"caption\":\"peer to peer sync with couchbase lite\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Peer-to-Peer Database Sync with Couchbase Lite\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c\",\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4b50a54778b979d8c345b036ab138734\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"caption\":\"Priya Rajagopal, Senior Director, Product Management\"},\"description\":\"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.\",\"sameAs\":[\"https:\/\/x.com\/rajagp\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/priya-rajagopalcouchbase-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Peer-to-Peer Database Sync with Couchbase Lite - The Couchbase Blog","description":"Couchbase Lite's enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/","og_locale":"en_US","og_type":"article","og_title":"Peer-to-Peer Database Sync with Couchbase Lite","og_description":"Couchbase Lite's enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.","og_url":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/","og_site_name":"The Couchbase Blog","article_published_time":"2020-10-19T16:00:29+00:00","article_modified_time":"2025-06-14T03:08:53+00:00","og_image":[{"width":1200,"height":627,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/Peer-to-Peer-Database-Sync-with-Couchbase-Lite.png","type":"image\/png"}],"author":"Priya Rajagopal, Senior Director, Product Management","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/Peer-to-Peer-Database-Sync-with-Couchbase-Lite.png","twitter_creator":"@rajagp","twitter_misc":{"Written by":"Priya Rajagopal, Senior Director, Product Management","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/"},"author":{"name":"Priya Rajagopal, Senior Director, Product Management","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c"},"headline":"Peer-to-Peer Database Sync with Couchbase Lite","datePublished":"2020-10-19T16:00:29+00:00","dateModified":"2025-06-14T03:08:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/"},"wordCount":1508,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg","keywords":["couchbase mobile 2.x","ios","swift"],"articleSection":["Android","Best Practices and Tutorials","Couchbase Architecture","Couchbase Lite","Couchbase Mobile","Edge computing","Solutions","Swift","Xamarin"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/","url":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/","name":"Peer-to-Peer Database Sync with Couchbase Lite - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg","datePublished":"2020-10-19T16:00:29+00:00","dateModified":"2025-06-14T03:08:53+00:00","description":"Couchbase Lite's enterprise-grade peer-to-peer database sync solution allows direct collaboration between clients in disconnected environments without the need for a cloud-based control point.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/10\/shutterstock_343020290.jpg","width":1200,"height":628,"caption":"peer to peer sync with couchbase lite"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/peer-to-peer-database-sync-with-couchbase-lite\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Peer-to-Peer Database Sync with Couchbase Lite"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c","name":"Priya Rajagopal, Senior Director, Product Management","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4b50a54778b979d8c345b036ab138734","url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","caption":"Priya Rajagopal, Senior Director, Product Management"},"description":"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.","sameAs":["https:\/\/x.com\/rajagp"],"url":"https:\/\/www.couchbase.com\/blog\/author\/priya-rajagopalcouchbase-com\/"}]}},"authors":[{"term_id":8948,"user_id":1423,"is_guest":0,"slug":"priya-rajagopalcouchbase-com","display_name":"Priya Rajagopal, Senior Director, Product Management","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","author_category":"","last_name":"Rajagopal, Senior Director, Product Management","first_name":"Priya","job_title":"","user_url":"","description":"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/9501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/1423"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=9501"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/9501\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/9502"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=9501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=9501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=9501"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=9501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}