Mobile App & Desktop/Web App Recommendation

38 views
Skip to first unread message

Daniel Owen

unread,
Sep 12, 2014, 5:38:26 AM9/12/14
to mobile-c...@googlegroups.com, za...@couchbase.com
I have read through the post Mobile App & Web App originally posted on Jan 28 by Francisco Garcia but was still unsure what to recommend to an experienced
C# .net / JavaScript web developer who is investigating building a Couchbase Lite app for both mobile and the desktop (ideally web access on the desktop).

The app requirements are:
- same authentication process for both the mobile and desktop/web.
- contents of the database needs to be kept in sync.  i.e. updates by a user on the desktop/web app need to be picked-up by the mobile app.

I appreciate the xamarin Couchbase Lite SDK will be great for the iOS/Android/Windows mobile solution.
But what about the web app (i.e. for running on Desktop)?  Should they use 

    - the Bucket Shadowing feature.?
    - Java SDK?
    - ???

Many thanks

Daniel

Jens Alfke

unread,
Sep 12, 2014, 1:18:47 PM9/12/14
to mobile-c...@googlegroups.com, za...@couchbase.com

> On Sep 12, 2014, at 2:38 AM, Daniel Owen <drdani...@gmail.com> wrote:
>
> …still unsure what to recommend to an experienced C# .net / JavaScript web developer who is investigating building a Couchbase Lite app for both mobile and the desktop (ideally web access on the desktop).

The ideal desktop solution (IMHO) would be a native app (Cocoa on OS X, .NET on Windows). Have you already ruled that out?

> - same authentication process for both the mobile and desktop/web.

Then you'd probably want to manage auth in the web-app server, and add an API endpoint that generates a Sync Gateway session cookie, as described in the "custom auth" section of the Gateway docs.

> - contents of the database needs to be kept in sync. i.e. updates by a user on the desktop/web app need to be picked-up by the mobile app.

We're still working out the best practices for this, and developing extra functionality for the Gateway to make it easier in future versions. There are two approaches you can use, based on whether you want your app server to talk to Sync Gateway or directly to the Couchbase Server.

(1) App server talks to Sync Gateway using its REST API. You can use any CouchDB adapter library if you don't want to code the REST calls yourself (e.g. Ektorp for Java; there's one for nearly any language you like.) The major gotcha right now is that Gateway 1.0.2 doesn't have its own API for creating or querying views. The workaround is to use the Couchbase Server API (which is nearly identical) for that.

(2) App server talks to Couchbase Server directly. You'll need to set up bucket-shadowing: you'll have a master bucket that your app server interacts with, and the Gateway will create and manage its own 'shadow' of that for its own use. You can use any Couchbase SDK to talk to the server.

Option 1 is lighter weight because you don't need to create a copy of your bucket. It also gives you better control over conflicts since you're talking to an API that understands revisions/conflicts/resolution.

Option 2 is probably a bit more stable because you're going through the well-established Couchbase Server API, i.e. you're using a version 2.5 or 3.0 product instead of 1.0 :)

—Jens
Reply all
Reply to author
Forward
0 new messages