Flow and Configuration of Push Notifications

Hello everyone, hope you all are good.

I am working on integrating push notifications on my Openfire Server. I have read the XEP-0357 specification. And, I have read about and installed the ‘Push Notification Plugin’ and ‘Openfire Push Server’.

So what I understand about how the flow will proceed is:

  1. XMPP Server generates notification. The Push Notification plugin will handle that
  2. The generated notification will be passed on to my preferred Push Service (e.g. Firebase CM). This step will be handled by the Openfire Push Server plugin.
  3. The end user (assuming the client is configured rightly) will get the notification.

The doubt: When will the server generate a notification, for which scenarios? What data (xml stanza I assume) will it have? These things are ambiguous to me right now.

Second thing, not completely Openfire related, but If you have worked with Firebase CM to push notifications, can you please share the details how you did it. The help would be immensely appreciated.

When you get a new message then Openfire Push Server generate a notification. And it use a XML format for this.

Yes, it will be XML, but what would be its structure, (like this ex12?), how would you handle that data.

If you want to know more about this then you can visit this github page.

Well, its the same readme file, doesn’t say anything else

PushNotification plugin doesn’t have direct integration with FCM as the plugin provides implementation of XEP-0357.

If you have your own server side integration with FCM then by using CallbackOnOffline plugin, you can get http call from Openfire whenever there is an offline message in 1-1 chat. Plugin configuration details are mentioned in it’s README file.

If you have your own server side integration with FCM then by using CallbackOnOffline plugin, you can get http call from Openfire whenever there is an offline message in 1-1 chat. Plugin configuration details are mentioned in it’s README file.

Well isn’t that what the Push Notification plugin for? Let us get on the same page, what does the Push Notification do?

The process of triggering a push notification is complex, because of the different administrative entities that are involved. It goes like this:

The Push Notification plugin cannot directly instruct FCM to generate a push notification, as FCM wants to make sure that this is tightly controlled (with regards to authentication an authorization). If they wouldn’t do that, then everyone and their uncle would be able to spam your phone with push notifications.

It’s the author of a particular client that wants its client to be capable to receive push notifications. This author is the one that has a account with FCM.

The client author is typically not the same entity as the administrator of the XMPP server. There is thus a need for a ‘proxy’ entity.

This is where the Push Server comes in. This server is ran/maintained by the client author. Its purpose is to handle push notifications for users of their client.

When an end-user’s client connects to Openfire, it registers that any push notifications are to be forwarded to the push notification server that is maintained by the client author. Whenever an event occurs that Openfire deems worthy of sending a push notification for, it will look up the registered push notification server for the account, and tell it to generate a push notification for a client. This push notification server will then interact with FCM (using the client author’s credentials) to have the actual push notification be delivered to the client of the end-user

1 Like

then how would I go about implementing notifications. I have searched but could not find a single clear source for actual implemetation.

The Openfire Push Notification plugin will trigger push notifications (based on message stanzas being received) but it is not programmable or configurable.

If you’d like to generate push notifications based on custom data or events, you may want to write your own plugin to replace the Push Notification plugin (or, alternatively, if what you’re writing would be of benefit to the larger community, you could consider creating a pull request to improve the existing plugin).

The source code of the plugin, that you can either improve, or use as inspiration, can be found at GitHub - igniterealtime/openfire-pushnotification-plugin: Openfire plugin that adds support for Push Notification (XEP-0357).

1 Like

Openfire Push Notification plugin will trigger push notifications (based on message stanzas being received) but it is not programmable or configurable.

So how are we supposed to use it exactly, its still unclear.
And the Push Server Plugin, it has configurations for iOS and Android.

So wouldn’t it work if I have both plugins installed. ‘Push Notification’ plugin generates notification, and ‘Push Server’ plugin will send them. (I do not want custom functionality for generating notifications)

You need two things:

  1. The push notification plugin installed on your instance of Openfire.
  2. The author of the client that you’re using needs to run a push server (which could be Openfire’s Push Notification server, but could also be any of the other servers that are available.

The second bit can, but does not need to be installed at your Openfire server. The client software will register for each user what the address of the to-be-used push notification server is. Your instance of Openfire will then use server-to-server connectivity (“federation”) to contact the server, if it happens to be installed elsewhere than in your own Openfire server.