To get started with the FCM JavaScript API, you’ll need to add Firebase to your web app and add logic to access registration tokens.
Read moreHow does cloud messaging work?
Short answer: FCM, or Firebase Cloud Messaging works by keeping a connection open towards the Google servers from your phone . This connection listens to messages from Google servers and takes action on your phone when messages are received.
Read more