Introduction to Cloud Functions
When you need a server. Do some background stuff (imagemagik, background tasks). The server can listen to database changes (Firebase NodeJS API is very similar to the browser API.)
github/firebase/firebase-samples : great repo for Firebase server side examples
The limitation of the free plan is that you can only talk to Google APIs.
Firebase messaging
For async messaging. If the users browser tab is not active, using service workers you can still send an alert.
Goal
"Send a new message to users who allowed, even the tab is not active"