{"id":1997,"date":"2015-10-28T02:31:44","date_gmt":"2015-10-28T02:31:43","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1997"},"modified":"2019-03-04T06:13:47","modified_gmt":"2019-03-04T14:13:47","slug":"couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/","title":{"rendered":"Couchbase LIVE Nova York: Couchbase Mobile 103 - Criando um aplicativo peer-to-peer com o Couchbase Mobile"},"content":{"rendered":"<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/CBNYC2015\"><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2015\/october\/couchbase-live-new-york-couchbase-mobile-103---building-a-peer-to-peer-app-with-couchbase-mobile\/events.cbliveny.bannerheader.lockup.png\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Na sess\u00e3o 103 do <a href=\"https:\/\/bit.ly\/couchbaseNYC01\">Couchbase LIVE New York pista m\u00f3vel<\/a>Na se\u00e7\u00e3o \"Sincroniza\u00e7\u00e3o\", examinamos o recurso do Couchbase Lite que nos permitiria ativar a sincroniza\u00e7\u00e3o ponto a ponto entre dois ou mais dispositivos.  A partir da se\u00e7\u00e3o <a href=\"https:\/\/www.slideshare.net\/Couchbase\/couchbase-mobile-101-couchbase-live-new-york?\">\"Couchbase Mobile 103: <\/a><a href=\"https:\/\/www.slideshare.net\/Couchbase\/couchbase-mobile-103-building-a-peer-topeer-app-with-couchbase-mobile-couchbase-connect-2015?qid=50d65718-e15f-4427-8051-dbb09b56d8c6&amp;v=default&amp;b=&amp;from_search=1\">Cria\u00e7\u00e3o de um aplicativo ponto a ponto com o Couchbase Mobile<\/a><a href=\"https:\/\/www.slideshare.net\/Couchbase\/couchbase-mobile-101-couchbase-live-new-york?\">\" slides<\/a>Na se\u00e7\u00e3o \"Compartilhamento de fotos\", exploramos em profundidade o c\u00f3digo e os componentes que permitiram que o aplicativo de compartilhamento de fotos trocasse fotos com outro dispositivo cliente que executava o Couchbase Lite por meio do recurso P2P.<\/p>\n<p style=\"text-align: justify;\">O aplicativo de amostra do PhotoDrop P2P pode ser encontrado no reposit\u00f3rio do GitHub para <a href=\"https:\/\/github.com\/couchbaselabs\/photo-drop\/tree\/master\/ios\">iOS<\/a> e <a href=\"https:\/\/github.com\/couchbaselabs\/photo-drop\/tree\/master\/android\">Android<\/a>.  Neste blog, recapitularemos em alto n\u00edvel os recursos e APIs do Couchbase Lite que foram apresentados na sess\u00e3o Couchbase 103, bem como alguns dos c\u00f3digos encontrados no exemplo de Compartilhamento de Fotos.  Voc\u00ea pode consultar o Couchbase Mobile <a href=\"https:\/\/bit.ly\/CBNYC2015_101\">101<\/a> e <a href=\"https:\/\/bit.ly\/CBNYC2015_102\">102<\/a> blogs para obter orienta\u00e7\u00e3o sobre como come\u00e7ar.<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2015\/october\/couchbase-live-new-york-couchbase-mobile-103---building-a-peer-to-peer-app-with-couchbase-mobile\/photodrop_screens.png\" \/><\/p>\n<p style=\"text-align: justify;\">Aqui est\u00e3o os storyboards do aplicativo, onde temos tr\u00eas ViewControllers simples, sendo que o ViewController \u00e9 o ponto de entrada do aplicativo.  O fluxo de experi\u00eancia do usu\u00e1rio come\u00e7a quando o remetente seleciona as fotos do telefone e clica em enviar.  A c\u00e2mera ser\u00e1 aberta para escanear o c\u00f3digo QR de recebimento do outro telefone a fim de autenticar e iniciar a transfer\u00eancia.  Vamos examinar os principais componentes do c\u00f3digo do aplicativo que habilita o recurso ponto a ponto a partir de <a href=\"https:\/\/developer.couchbase.com\/documentation\/mobile\/1.1.0\/get-started\/couchbase-lite-overview\/index.html\">Couchbase Lite<\/a>.<\/p>\n<p style=\"text-align: justify;\"><strong>[1] Iniciar ouvinte<\/strong><\/p>\n<p style=\"text-align: justify;\">No ReceiveViewController, definimos a porta como sendo igual a zero para que deixemos o Couchbase Lite decidir o que usar.  Isso significa que, sempre que quisermos compartilhar as fotos, a porta ser\u00e1 alterada toda vez que ele iniciar uma transfer\u00eancia.  Ativamos a autentica\u00e7\u00e3o, na qual a autentica\u00e7\u00e3o \u00e9 o resumo e \u00e9 suportada pelo ouvinte do Couchbase Lite por padr\u00e3o.  Depois disso, temos o nome de usu\u00e1rio e a senha e definimos o nome de usu\u00e1rio\/senha para a autentica\u00e7\u00e3o.  Depois disso, estamos prontos para iniciar os ouvintes.<\/p>\n<p style=\"text-align: justify;\"><strong>iOS<\/strong><\/p>\n<pre><code class=\"language-swift\">listener = CBLListener(manager: CBLManager.sharedInstance(), port: 0)\r\n\r\nlistener.requiresAuth = true\r\nlet username = secureGenerateKey(NSCharacterSet.URLUserAllowedCharacterSet())\r\nlet password = secureGenerateKey(NSCharacterSet.URLPasswordAllowedCharacterSet())\r\nlistener.setPasswords([username : password])\r\n\r\nvar success = listener.start(&amp;error)\r\n\r\nif (success) {\r\n  syncUrl = genearteSyncURL(listener.URL, username: username, password: password, \r\n  dbName: database.name)\r\n\r\n  startObserveDatabaseChange()\r\n}\r\n<\/code><\/pre>\n<p>Depois que o ouvinte \u00e9 iniciado, geramos o URL de sincroniza\u00e7\u00e3o do ponto de extremidade do URL para o banco de dados receptor usando o URL do ouvinte com o nome de usu\u00e1rio\/senha e o nome do banco de dados.  Definimos o URL na vari\u00e1vel de URL de sincroniza\u00e7\u00e3o e o usamos mais tarde quando geramos o c\u00f3digo QR, a partir do qual iniciamos os ouvintes de altera\u00e7\u00e3o do banco de dados adequadamente.<\/p>\n<p style=\"text-align: justify;\"><strong>[2] Observar altera\u00e7\u00f5es no banco de dados<\/strong><\/p>\n<p>Iniciamos o ouvinte de altera\u00e7\u00f5es no banco de dados para sabermos quando a foto \u00e9 sincronizada com o banco de dados do receptor.  Quando isso acontece, obtemos as fotos compartilhadas dos documentos compartilhados e as aceitamos no dispositivo.<\/p>\n<p style=\"text-align: justify;\"><strong>iOS<\/strong><\/p>\n<pre><code class=\"language-swift\">func startObserveDatabaseChange() {\r\n  NSNotificationCenter.defaultCenter().addObserverForName(\r\n  kCBLDatabaseChangeNotification, object: database, queue: nil) { (notification) -&gt; Void in\r\n   if let changes = notification.userInfo![\"changes\"] as? [CBLDatabaseChange] {\r\n      for change in changes {\r\n        dispatch_async(dispatch_get_main_queue(), {\r\n          self.saveImageFromDocument(change.documentID)\r\n        })\r\n      }\r\n   }\r\n  }\r\n}<\/code><\/pre>\n<p><strong>[3] Gerar e exibir c\u00f3digo QR<\/strong><\/p>\n<p style=\"text-align: justify;\">Na \u00faltima etapa do ReceiveViewController, quando temos os ouvintes do Couchbase Lite, configuramos os ouvintes compartilhados do banco de dados e, em seguida, temos o URL de sincroniza\u00e7\u00e3o.  Com o URL de sincroniza\u00e7\u00e3o, podemos gerar o c\u00f3digo QR.  Para fazer isso, usamos o filtro de imagem principal do iOS.  O c\u00f3digo QR cont\u00e9m a porta do ouvinte e o nome de usu\u00e1rio\/senha inclu\u00eddos para autentica\u00e7\u00e3o.<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2015\/october\/couchbase-live-new-york-couchbase-mobile-103---building-a-peer-to-peer-app-with-couchbase-mobile\/qr-code-content.png\" \/><strong>[4] Ler o c\u00f3digo QR<\/strong><\/p>\n<p style=\"text-align: justify;\">Agora, no SendViewController, usamos a classe iOS AVCaptureSession, que faz parte da estrutura AV Foundation com o tipo de sa\u00edda AVMetadataObjectTypeQRCode.  Isso agora nos permitir\u00e1 usar o scanner de c\u00f3digo QR e escanear o c\u00f3digo QR.<\/p>\n<p><strong>[5] Criar documentos<\/strong><\/p>\n<p style=\"text-align: justify;\">Agora, iteramos as fotos que queremos enviar aos destinat\u00e1rios.  Para cada foto, criamos um documento e, em seguida, anexamos a foto ao documento para salvar no banco de dados.  No \u00faltimo snippet, salvaremos os IDs dos documentos na vari\u00e1vel docIds, que \u00e9 uma propriedade que ser\u00e1 usada na etapa seguinte.<\/p>\n<p><strong>iOS<\/strong><\/p>\n<pre><code class=\"language-swift\">var docIds: [String] = []\r\nfor asset in sharedAssets! {\r\n  \/\/...\r\n  var data = NSData(bytesNoCopy: imageBytes, length: buffered, freeWhenDone: true)\r\n\r\n  let doc = database.createDocument()\r\n  let rev = doc.newRevision()\r\n  rev.setAttachmentNamed(\"photo\", withContentType: \"application\/octet-stream\", content: data)\r\n  let saved = rev.save(&amp;error)\r\n\r\n  if saved != nil {\r\n    docIds.append(doc.documentID)\r\n  }\r\n}\r\n<\/code><\/pre>\n<p><strong>[6] Replicar documentos<\/strong><\/p>\n<p style=\"text-align: justify;\">A \u00faltima etapa, agora que temos o URL de sincroniza\u00e7\u00e3o que obtivemos do c\u00f3digo QR, \u00e9 replicar os documentos adequadamente.  Temos os documentos com foto do banco de dados e estamos prontos para replicar do dispositivo cliente emissor para o dispositivo receptor.  Aqui, criamos uma replica\u00e7\u00e3o por push com a URL de sincroniza\u00e7\u00e3o, na qual enviamos o ID do documento para o replicador, permitindo que o replicador fa\u00e7a push dos documentos com o ID.  E, como etapa opcional, definimos os estados dos ouvintes de altera\u00e7\u00e3o de replica\u00e7\u00e3o para capturar o status atual.<\/p>\n<p><strong>iOS<\/strong><\/p>\n<pre><code class=\"language-swift\">replicator = database.createPushReplication(url)\r\nreplicator.documentIDs = docIds\r\n\r\nNSNotificationCenter.defaultCenter().addObserverForName(kCBLReplicationChangeNotification, object: replicator, queue: nil) { (notification) -&gt; Void in\r\n  if self.replicator.lastError == nil {\r\n    var totalCount = self.replicator.changesCount\r\n    var completedCount = self.replicator.completedChangesCount\r\n    \r\n    if completedCount &gt; 0 &amp;&amp; completedCount == totalCount {\r\n      self.statusLabel.text = \"Sending Completed\u201d\r\n    }\r\n  } else {\r\n      self.statusLabel.text = \"Sending Abort\"\r\n    }\r\n}\r\n\r\nreplicator.start()\r\n\r\n<\/code><\/pre>\n<p><strong>Resumo<\/strong><\/p>\n<p style=\"text-align: justify;\">Os principais pontos de implementa\u00e7\u00e3o dos aplicativos Photodrop s\u00e3o que eles usam o c\u00f3digo QR para descoberta de pares, onde geramos um nome de usu\u00e1rio e uma senha \u00fanicos para autentica\u00e7\u00e3o.  O c\u00f3digo principal para envio\/recebimento de fotos tem cerca de 100 linhas de c\u00f3digo e n\u00e3o cont\u00e9m nenhum c\u00f3digo diretamente envolvido na comunica\u00e7\u00e3o de rede.<\/p>\n<p style=\"text-align: justify;\">","protected":false},"excerpt":{"rendered":"<p>From the 103 session in the Couchbase LIVE New York mobile track, we went over the feature within Couchbase Lite that would allow us to enable peer-to-peer syncing between two or more devices.\u00a0 From the &#8220;Couchbase Mobile 103: Building a [&hellip;]<\/p>","protected":false},"author":30,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8983],"class_list":["post-1997","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Building a Peer-to-Peer App with Couchbase Mobile<\/title>\n<meta name=\"description\" content=\"Check out the feature within Couchbase Lite that would allow us to enable peer-to-peer syncing between two or more devices.\u00a0\" \/>\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\/pt\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase LIVE New York: Couchbase Mobile 103 - Building a Peer-to-Peer App with Couchbase Mobile\" \/>\n<meta property=\"og:description\" content=\"Check out the feature within Couchbase Lite that would allow us to enable peer-to-peer syncing between two or more devices.\u00a0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-28T02:31:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-04T14:13:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"William Hoang, Mobile Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"William Hoang, Mobile Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\"},\"author\":{\"name\":\"William Hoang, Mobile Developer Advocate, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/425717456c198fdf9aaa5d7a6d42ad32\"},\"headline\":\"Couchbase LIVE New York: Couchbase Mobile 103 &#8211; Building a Peer-to-Peer App with Couchbase Mobile\",\"datePublished\":\"2015-10-28T02:31:43+00:00\",\"dateModified\":\"2019-03-04T14:13:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\"},\"wordCount\":761,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\",\"name\":\"Building a Peer-to-Peer App with Couchbase Mobile\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2015-10-28T02:31:43+00:00\",\"dateModified\":\"2019-03-04T14:13:47+00:00\",\"description\":\"Check out the feature within Couchbase Lite that would allow us to enable peer-to-peer syncing between two or more devices.\u00a0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase LIVE New York: Couchbase Mobile 103 &#8211; Building a Peer-to-Peer App with Couchbase Mobile\"}]},{\"@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\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@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\/425717456c198fdf9aaa5d7a6d42ad32\",\"name\":\"William Hoang, Mobile Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/650445f1ea30314c4f3555dd680154f5\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b912c9a97568a859697ee195432d0bd7cc3ed67d720ae2e6588b67313fa49e08?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b912c9a97568a859697ee195432d0bd7cc3ed67d720ae2e6588b67313fa49e08?s=96&d=mm&r=g\",\"caption\":\"William Hoang, Mobile Developer Advocate, Couchbase\"},\"description\":\"William was a Developer Advocate on the Mobile Engineering\/Developer Experience team at Couchbase. His love for coffee and code has transcended him into the world of mobile while appreciating the offline in-person experiences. Prior, William worked on the Developer Relations team over at Twitter, BlackBerry, and Microsoft while also having been a Software Embedded GPS engineer at Research In Motion. William graduated from McGill University in Electrical Software Engineering\",\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/william-hoang\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Cria\u00e7\u00e3o de um aplicativo ponto a ponto com o Couchbase Mobile","description":"Confira o recurso do Couchbase Lite que nos permitiria ativar a sincroniza\u00e7\u00e3o ponto a ponto entre dois ou mais dispositivos.\u00a0","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\/pt\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/","og_locale":"pt_BR","og_type":"article","og_title":"Couchbase LIVE New York: Couchbase Mobile 103 - Building a Peer-to-Peer App with Couchbase Mobile","og_description":"Check out the feature within Couchbase Lite that would allow us to enable peer-to-peer syncing between two or more devices.\u00a0","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/","og_site_name":"The Couchbase Blog","article_published_time":"2015-10-28T02:31:43+00:00","article_modified_time":"2019-03-04T14:13:47+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"William Hoang, Mobile Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"William Hoang, Mobile Developer Advocate, Couchbase","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/"},"author":{"name":"William Hoang, Mobile Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/425717456c198fdf9aaa5d7a6d42ad32"},"headline":"Couchbase LIVE New York: Couchbase Mobile 103 &#8211; Building a Peer-to-Peer App with Couchbase Mobile","datePublished":"2015-10-28T02:31:43+00:00","dateModified":"2019-03-04T14:13:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/"},"wordCount":761,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Uncategorized"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/","name":"Cria\u00e7\u00e3o de um aplicativo ponto a ponto com o Couchbase Mobile","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2015-10-28T02:31:43+00:00","dateModified":"2019-03-04T14:13:47+00:00","description":"Confira o recurso do Couchbase Lite que nos permitiria ativar a sincroniza\u00e7\u00e3o ponto a ponto entre dois ou mais dispositivos.\u00a0","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-live-new-york-couchbase-mobile-103-building-a-peer-to-peer-app-with-couchbase-mobile\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Couchbase LIVE New York: Couchbase Mobile 103 &#8211; Building a Peer-to-Peer App with Couchbase Mobile"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","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":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@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\/425717456c198fdf9aaa5d7a6d42ad32","name":"William Hoang, defensor do desenvolvedor m\u00f3vel, Couchbase","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/650445f1ea30314c4f3555dd680154f5","url":"https:\/\/secure.gravatar.com\/avatar\/b912c9a97568a859697ee195432d0bd7cc3ed67d720ae2e6588b67313fa49e08?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b912c9a97568a859697ee195432d0bd7cc3ed67d720ae2e6588b67313fa49e08?s=96&d=mm&r=g","caption":"William Hoang, Mobile Developer Advocate, Couchbase"},"description":"William foi um defensor do desenvolvedor na equipe de engenharia m\u00f3vel\/experi\u00eancia do desenvolvedor na Couchbase. Seu amor por caf\u00e9 e c\u00f3digo o levou ao mundo dos dispositivos m\u00f3veis, ao mesmo tempo em que apreciava as experi\u00eancias presenciais off-line. Antes disso, William trabalhou na equipe de rela\u00e7\u00f5es com desenvolvedores do Twitter, BlackBerry e Microsoft, al\u00e9m de ter sido engenheiro de GPS incorporado a software na Research In Motion. William se formou na McGill University em Engenharia El\u00e9trica de Software","url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/william-hoang\/"}]}},"authors":[{"term_id":8983,"user_id":30,"is_guest":0,"slug":"william-hoang","display_name":"William Hoang, Mobile Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/b912c9a97568a859697ee195432d0bd7cc3ed67d720ae2e6588b67313fa49e08?s=96&d=mm&r=g","author_category":"","last_name":"Hoang","first_name":"William","job_title":"","user_url":"","description":"William foi um defensor do desenvolvedor na equipe de engenharia m\u00f3vel\/experi\u00eancia do desenvolvedor na Couchbase. Seu amor por caf\u00e9 e c\u00f3digo o levou ao mundo dos dispositivos m\u00f3veis, ao mesmo tempo em que apreciava as experi\u00eancias presenciais off-line. Antes disso, William trabalhou na equipe de rela\u00e7\u00f5es com desenvolvedores do Twitter, BlackBerry e Microsoft, al\u00e9m de ter sido engenheiro de GPS incorporado a software na Research In Motion. William se formou na McGill University em Engenharia El\u00e9trica de Software"}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=1997"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1997\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=1997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=1997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=1997"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=1997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}