0

I have mobile and rails application. I wrote synchronization between both apps. On server app I have API. Mobile app send request I process all data and respond to mobile. My problem is that many times I have situations that user want to synchronize a lot of data and this process spend more. In these situations I exceed http response timeout and I got http errors. Best solution for me is to put whole synchronization algorithm to separate ruby worker. But in this case how to respond to mobile application. I would like to avoid that mobile will "bomb" server by requests like "Is synchronization over?". How to response with processed data? What is the best solution? Thanks for all answers

Edit:

I decided to use push notifications to inform mobile app that synchronization is over. Then mobile can send request http to the server.

user2239655
  • 830
  • 2
  • 11
  • 28
  • You can use MQTT to sync data for many different systems. They will not depend on the language (C #, JAVA, JAVASCRIPT ...). It will give you the best performance. Your Data will real-time. – VuNT Nov 06 '18 at 01:41

1 Answers1

0
  1. if possible, reduce sync payloads by syncing more often.

  2. "bombing the server" is called short-polling and it's a valid, easy-to-implement approach (these requests should be quick, anyway)

  3. More efficient (though more involved and complicated) approach is called "long polling". It usually involves some kind of a socket server.

This link might be useful: Short-polling vs. long-polling in web applications.

Community
  • 1
  • 1
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367