Another alternative here is to just pass the information through the database, which often turns out to be much simpler (no RESTful services, no security needed, et al).
By adding security rules to a path in your database, you can use the database as your central endpoint, bypass the need to enforce security (if they can write to the path, they are authenticated), and turn your server processes into small, robust, scalable workers. For example, I could create a path like the following:
{
"server_queue": {
"$task_id": {
".write": "auth != null && newData.exists() && newData.hasChildred(['uid', 'data']);
"uid": { ".validate": "newData.val() === auth.uid" },
"data": { ... }
}
}
}
And now my server can simply listen for add events on that path, process the records, and respond in some way to the client (probably by just writing results back to the database).
This model survives server restarts and outages, and using a tool like
firebase-queue, you gain flexibility, modularity, and scalability to your worker processes.
☼, Kato