2

When an online client (a desktop) and an offline client (a phone) both enter data, and the phone is brought back online, the phone does not receive the data posted on the desktop during the offline period.

To duplicate, in an empty directory, run firebase bootstrap, enter the name of your app, and choose the react template. Then do firebase deploy and firebase open to visit the page in the desktop browser. Then visit the same page in the phone browser.

Begin entering data alternately in the React + Plain Firebase pane of the desktop and phone browsers. Enter '1' on the desktop, '2' on the phone, '3' on the desktop, etc. So far the series displays 1 2 3 on both browsers as expected. Then put the phone in airplane mode and continue entering numbers alternately. Now the desktop shows only the odd numbers that are being added, and the phone shows only the even. This is also expected.

Now bring the phone back online. The phone will push its data to firebase and the even numbers will show up on the desktop (although oddly in a different order in the React + Plain Firebase pane and the React + ReactFire pane).

But the odd numbers do not show up on the phone, until the app is reloaded. Is this expected? Is there a way to force a complete resync in when a client goes online?

UPDATE: Other questions I have seen on firebase offline usage have been about detecting presence, user auth or other more complicated scenarios. My case is simpler. The docs say:

Once connectivity is reestablished, we'll receive the appropriate set of events so that the client "catches up" with the current server state, without having to write any custom code.

To me, this means that syncing should "just work" without the necessity of the app "knowing" whether or not it is online or doing anything special when it goes online.

I was also assuming that firebase offline data storage is persistent, but Kato's recent comment to this question indicates that it is not. So I guess the answer is that Firebase's offline storage implementation is incomplete, and its limitations are not well documented.

Community
  • 1
  • 1
chetstone
  • 650
  • 1
  • 9
  • 19
  • Check out the comment Kato left on this question: http://stackoverflow.com/questions/28663496/firebase-ondisconnect-broken-with-airplane-mode – sbolel Mar 09 '15 at 01:00
  • @SinanBolel - That question is about a more complicated scenario of detecting presence. See the clarification I have added to my question. – chetstone Mar 11 '15 at 19:23
  • I went through your reproduction steps, but it seems to work just fine on my end. I posted 1 on the computer, 2 on the phone, 3 on computer, put phone into airplane mode, posted 4, brought phone back online, and 4 pushed just fine. – sbolel Mar 12 '15 at 02:04
  • Interesting... I did it again, but this time it didn't work. – sbolel Mar 12 '15 at 02:09
  • Ok. So... Here's something that's even more interesting. If you first load the app on the phone, not enter anything, take the phone offline, and enter a bunch of data on the computer, and bring the phone back online, the phone pulls the changes. However, if you load the app on the phone, enter something, take it offline, enter something on the computer, then bring the phone back online, it doesn't pull the newest data from the computer. – sbolel Mar 12 '15 at 02:17
  • I'm not as familiar with React as I'd like to be. I tried the angular seed, and the AngularFire sync works fine when the phone comes back online. – sbolel Mar 12 '15 at 04:08

0 Answers0