javascriptwebsocketfirebase-cloud-messaginginstant-messaging

Does FCM (web) use WebSocket for the recipient of messages?


i just wonder how the "FCM" realy works on the web. does it use websocket ,or it's a built in feature whit in browsers (chrome,firefox ,...)


Solution

  • FCM (Firebase Cloud Messaging) uses HTTP and XMPP Server Protocol serving JSON and Plain Text both.

    FCM Server Protocols Currently FCM provides these raw server protocols:

    1. FCM HTTP v1 API
    2. Legacy HTTP protocol
    3. Legacy XMPP Protocol

    Your app server can use these protocols separately or in tandem. Because it is the most up-to-date and most flexible for sending messages to multiple platforms, the FCM HTTP v1 API is recommended wherever feasible. If your requirements include upstream messaging from devices to the server, you'll need to implement the XMPP protocol.

    Below snap describes how it works Please visit About Firebase Cloud Messaging Server | Firebase for more details,https://firebase.google.com/docs/cloud-messaging/server#choose. Hope it helps.

    How exactly are web push notifications delivered to a user's device?

    There are three actors involved with delivering a web push notification, along with a fourth, optional, component for advanced functionality.

    1. Web Push Notification Service: Each browser, including Chrome, Safari and Firefox have their own notification delivery service. Chrome uses Google Cloud Messaging (and now Firebase Cloud Messaging ), Safari uses Apple Push Notification Service (APNS) and Firefox uses MDN servers.

    2. Service Worker Registration: Developer must register the service worker on the browser. This is only for Chrome and Firefox. Safari while has added support for service-workers, Safari notifications are delivered using a different mechanism.

    3. User’s Subscription ID: Subscriber ID is generated when a user opts in to receive notifications from a specific website.

    Additionally an SDK (OS client library Software Development Kit) can be added to a web app for extended segmentation and analytics capabilities.