2

I want to implement my own push notification server, more than a need for the product I want to know How it can be implemented.

I read documents for XMPP servers like tigase, ejabberd and openfire. I know that XMPP servers can handle online messages really straight forward, just like sending notifications as chat messages. Here is what I think is true:

Hypothesis: Having an OTT (i.e. Telegram), you can send notifications or chat messages by the XMPP client (the mobile app) and an XMPP server (i.e. ejabberd), or think of a pub/sub app that gets server status changes on a mobile device is using ejabberd as XMPP server and another XMPP client as an app on mobile.

My question is, if the hypothesis that I mentioned above is right, a push notification server would be a message queuing server to queue Pub/Sub messages for offline users and an XMPP server to send notifications/messages to online users.

Is it right? I can have my own GCM-like server by having a message broker to handle the queues and an XMPP server to handle message sending?

Reza Ameri
  • 1,803
  • 3
  • 24
  • 32

1 Answers1

3

You can definitely use an XMPP server like ejabberd to implement your own push notification service on Android. You need to have an application that stays constantly connected and will use the local Android API to display notification on the mobile when receiving a message.

On Android, receiving a notification is clearly separated from displaying it. It means you can receive it by any mean you like, but still display it as a standard notifications, even if it did not come to your device through GCM

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
  • Thank you for your answer, I know I am capable of doing that. but **HOW** is the problem.Is it as efficient as GCM or not. What would be the good architecture for implementing the push notification using an XMPP server? – Reza Ameri Jul 26 '15 at 11:54
  • It can be as efficient as GCM indeed, that depends on how polished a client for keeping the XMPP link you can build. Architecture is pretty straighforward: Android client to receive messages connected to an XMPP server that serve as a push dispatcher. – Mickaël Rémond Jul 26 '15 at 13:43
  • first I have to thank you for your patience and answers. This solution is work properly for users who are online, my problem is that I don't know what would happen in the situation that the client is offline. Who is responsible for saving and queuing messages for offline users? Do the XMPP server handle this queuing and sends the stored messages to a user as it gets online? – Reza Ameri Jul 27 '15 at 04:47
  • 1
    Every XMPP servers implements offline message queue. They all supports sending the offline messages on reconnect. As you can imagine all chat systems wants their users to receive messages they missed while offline. So, yes, XMPP will take care of that. – Mickaël Rémond Jul 27 '15 at 06:43
  • That is perfect :), This made me think "so why people use GSM like services?" I think ejaberd is really powerful and cool to use. Is it the ease of GCM use (resource, money, http ready)? – Reza Ameri Jul 27 '15 at 06:51
  • 2
    Yes, it is not trivial to build the final product. Building a robust client is difficult. Building the infrastructure is difficult. If you just want to do push alerts, it is far easier and cheaper to use Google infrastructure. You need a very good reason to build your own. – Mickaël Rémond Jul 27 '15 at 06:52