离线火力地堡 [英] Offline Firebase

查看:217
本文介绍了离线火力地堡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现与火力地堡作为后端的AngularJS Web应用程序;它应该脱机工作,太多;多用户同步的问题应该是非常有限的,因为应用程序 - 设计 - 将只允许的新的的数据条目离线时

I am implementing an AngularJS web app with Firebase as a backend; it should work offline, too; multi-user sync issues should be very limited, since the app - by design - will only allow new data entries when offline.

我明白火力地堡有离线功能,在这个意义上,客户可以承受暂时的网络连接故障:任何写操作将被推迟,直到缓存网络再次出现

I understand Firebase has offline capabilities, in the sense that a client can withstand temporary network connection failures: any write operation will be delayed and cached until network comes up again.

我问任何可能性确实存在(或是否有任何计划,以实现它)来扩展火力地堡脱机功能,使客户能够在本地缓存的(一些)服务器上的数据的快照,能够为客户提供一个完成线下体验,与现有的读操作了。

I ask if any possibility does exist (or does any plan to implement it) to extend Firebase offline capabilities to enable clients to locally cache a snapshot of (some of) the data on the server, to be able to offer clients a complete offline experience, with read operations available, too.

我看到存在第三部分火力地堡的包装,但它的文档是很有限(来样.. :-)。 A 本地的解决方案应该是preferred ...

I see a third part Firebase wrapper exists, but it's documentation is quite 'limited' (to be kind... :-). A native solution should be preferred...

更新:弗兰克面包车Puffelen评论后,我更合格我的问题:

UPDATE: After Frank van Puffelen comment, I better qualify my question:

*火力地堡是否原生支持离线数据的访问将它任何时间很快的在它的Web API或*?

*Does Firebase natively support offline data access in its Web API, or will it any time soon?*

推荐答案

这是解决这个问题的JS应用到火力地堡的替代方法是 CouchDB的(服务器)< = GT; PouchDb(JS客户端)。如果你已经实现了一个很好的清洁服务层为您AngularJS应用程序,然后移植到PouchDb应该是相当简单的,因为两者都是的NoSQL / JSON 数据库。

An alternative to Firebase that solves this problem for JS apps is CouchDb (server) <=> PouchDb (JS client). If you've implemented a nice clean Service layer for your AngularJS app then porting to PouchDb should be fairly straight forward since both are NoSQL/JSON databases.

PouchDb是执行完全离线 CouchDB的客户端的Javascript API。它可以自动检测并使用 _local存储_ _IndexDb _ _WebSQL _ 永久同时联机或脱机坚持本地数据。该PouchDb API可用于访问访问本地或远程数据库(只需更改URL)两者之间及导线上完全同步或过滤同步。有许多有用的PouchDb插件,code样品和小包装库,以支持AngularJS Q值承诺API。

PouchDb is a Javascript API that implements a fully offline CouchDb client. It can auto detect and use either _local storage_, _IndexDb_ or _WebSQL_ to permanently persist local data while online or offline. The PouchDb API can be used to access either your local or remote databases (just change the URL) and wire up full syncing or filtered syncing between the two. There are many useful PouchDb plugins, code samples and a small wrapper library to support AngularJS's Q promises API.

使用PouchDb,您可以在脱机,然后两天后重新启动您的应用程序和同步您所有的数据CUD更改服务器安全地启动你的应用程序。这可能会导致更新冲突使CouchDB的支持,旨在探测和跟踪该记录的版本。因此,您可能会需要服务器端逻辑来解决这些冲突。这是不可避免的与离线同步和CouchDB中的一个主要特征的分布式系统(并不完全正确......看评论)

Using PouchDb, you can safely start up your app while offline and then days later restart your app and sync all your CUD data changes to the server. This can result in update collisions so CouchDb supports record versioning that is designed to detect and track this. Consequently, you'll likely need server side logic to resolve these collisions. This is unavoidable for distributed systems with offline synchronization and a key feature of CouchDb (not quite true ... see comments)

PouchDb基本的Apache CouchDB中的重新实现,包括它的高效率同步协议。双方的CouchDB和PouchDb是行之有效的,自由和开放源码。作为开源意味着CouchDB的服务器还可以部署为内​​部网服务 - 可选择同步到外部云服务。有一些CouchDB的托管服务提供商。

PouchDb is basically a reimplementation of Apache CouchDb including it's efficient synchronization protocol. Both CouchDb and PouchDb are well tested, free and open source. Being open source means that a CouchDb server can also be deployed as an Intranet service - optionally syncing to an external cloud service. There are a number of CouchDb hosting providers.

该Cloudant托管团队最近增加他们的BigCouch群集功能到Apache CouchDB的2.0项目,所以现在你可以从微DB(PouchDb)规模=>单服务器=>多主(复制)=>大沙发集群/地理位置集群。不像MongoDB中,CouchDB的安全支持单一服务器部署。

The Cloudant hosting team recently added their BigCouch clustering features to Apache CouchDb 2.0 project so now you can scale from Micro Db (PouchDb) => Single Server => Multi-Master (Replicated) => Big Couch Clustered / Geo Clustered. Unlike MongoDb, CouchDb safely supports single server deployment.

注:PouchDb也可以使用相同的协议,但Couchbase == CouchDB的同步到CouchBase。这是一个商业产品。

NOTE: PouchDb can also sync to CouchBase using the same protocol but Couchbase !== CouchDb. It's a commercial product.

  • How to code your CouchDb and PouchDb replication for mobile or web apps.
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆