Overview

This section is for the Ionic 4 version of this platform, where Firebase Functions were used to make the apps talk to each other. Ionic 5 version does not use Firebase Functions.

All three apps are connected to the Firebase back-end for most functionalities. But there are events when the apps need to talk to each other directly. E.g. When user books a ride, the Driver app needs to know. And when Driver app confirms the ride, the user app needs to know that immediately as well.

Normally, a server response is sent only when app requests it via an API call. But for the situations mentioned above, we can't keep calling APIs to expect a response at some point of time. In this situation we use a combination of Firebase real-time DB and Firebase functions.

For example, in above scenario - User books a ride , the following things will happen

  • User app will call a Firebase function (via an API). The firebase function will take user's location etc information and search for drivers from the available database. Yes, Firebase function will have access to the database

  • Once a suitable Driver is found, his app will be sent a notification via Firebase socket connection (or real-time DB you can say). Driver will see the alert on his app

  • When Driver accepts or rejects the ride, another Firebase function is called. This function writes the relevant information in DB, as well as, sends a real-time notification to User app. User app shows relevant alert if ride is cancelled, or a confirmation if the ride is confirmed

Similarly, when the ride is ended from Driver side, the User app is informed of this via real-time DB notification.

Please note, the DB notification, or the real-time socket connection is different from push notification. Push notifications can be received in closed apps as well, but DB information update will be received in open app only.

Also, if you want to implement a push notification feature for booking flow, you can follow our detailed tutorial for the same

Last updated