In my understanding, Firebase Realtime Database can sync the data to the mobile clients only when the app is in foreground and not in killed/background state. This needs developers to handle the killed/background app case separately, and send a push notification to the device (e.g. chat notification). For the right UX, the push notification should only be sent to the apps in killed/background state. So, to detect whether the app is in the foreground or killed/background state, the server will need to maintain a WebSocket connection with every foreground running app. But doesn't this defeat the purpose of using Realtime Database, as the WebSocket itself can be used to sync data now? Or am I missing something?
This may not be what you are looking for, but why not use a combination of Postgres listen/notify and PushPin[0] to support push notifications?<p>[0] <a href="https://pushpin.org" rel="nofollow">https://pushpin.org</a>