freedomjs / freedom-social-firebase

Firebase Social Provider
0 stars 0 forks source link

Fix race condition where instance messages were lost #16

Closed dborkan closed 9 years ago

dborkan commented 9 years ago

Fix race condition where instance messages were lost. Fixes https://github.com/uProxy/uproxy/issues/1298

The problem was that upon login we immediately broadcast our client as being ONLINE, even before we setup an inbox for each friend to write to. This means that friends can send us instance messages before we have an inbox setup for them.

Previously, when creating an inbox for a friend, we cleared any existing data for that friend. Now we still create an inbox at the same time, but don't initialize it to empty. This ensures that messages received before the inbox is created can still be read.

Tested in uProxy using Facebook social provider

agallant commented 9 years ago

After a brief look at the Firebase docs, LGTM. :+1: