notifier icon indicating copy to clipboard operation
notifier copied to clipboard

Supporting Push Notifications (Firebase)

Open alimate opened this issue 5 years ago • 0 comments

Synopsis

Given a few destinations or a topic, we should be able to send the requested push notification using Firebase Legacy API.

Legacy API

We may use the airbase Legacy API to send push notifications. The main rationale behind using the Legacy API is the fact that the new API does not support the multicast feature.

Workflow

  • [ ] The client builds and populates the message using Protobuf
  • [ ] Then it pushes the new notification request to notifier.notifications.push topic
  • [ ] General listener received the notification request and dispatches to the Notifier implementation responsible for handling the push notifications.
  • [ ] The Notifier implementation validates the requests and sends the notification to its intended destinations.

Requirements

  • [x] Create the necessary Protobuf spec.
  • [ ] Implement the PushNotifier

References

Additional Info

When we're sending a notification to a single topic, Firebase returns a JSON result with the following schema:

{
    "message_id" // The topic message ID.
    "error" // Error that occurred when processing the message.
}

Also, if we send a multicast or unicast message via registration tokens, the JSON schema would be something like:

{
    "multicast_id" //  Unique ID (number) identifying the multicast message.
    "success" // Number of messages that were processed without an error.
    "failure" // Number of messages that could not be processed.
    "results" // Array of objects representing the status of the messages processed.
}

alimate avatar Nov 16 '19 08:11 alimate