Ruby on Rails
Friday, September 1, 2017
On Friday, July 21, 2017 at 11:20:15 PM UTC-7, siva subrahmanyam wrote:
Hi,I want build an Rails API which serves as backend for a mobile app. Since the mobile app will be used in offline mode. Hence I want data updates needs to be synced between mobile and web app. What would be the best possible solution for this kind problems?
The trickiest part of this type of architecture is handling problems like multiple updates to the same object from different sources. Since it sounds like you are not going to have much of that -- but it does need to be handled in some way if it can happen at all!
Google's Protobuf stuff is pretty good for packaging data in a cross language portable way and is much faster than JSON in RoR. But if your volume of data and connections is reasonable, then JSON is pretty easy to deal with in Ruby, Java and I assume Swift.
Using simple object APIs in RoR is what we have done in the past. If you don't use some external service, you usually end up creating a simple protocol for the phones to use to communicate with the back end.
Communications from the server to the phone can be done in an easy way by having the mobile device periodically check for updates, at which time the server can tell it what messages it needs. The more complicated way is to use the platform notification system (On Android it is Google Cloud Messaging) to tell the device to check-in with the server. The important point is that these push notification systems don't typically guarantee delivery. Google for example says it may deliver 1 message even if you send 10. So that means you really only want to use it to poke the app into checking in with the server.
Regards,
Brendon.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9a12d666-30f7-476b-95fb-170e7bcb129a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment