ejabberd and Push Notification
Solution 1
Please use the below blog , it is very simple and useful, it is works fine for me.
http://symmetricinfinity.com/2013/01/23/ios-push-notifications-from-ejabberd.html
Solution 2
There is no ejabberd plugin for apns or gcm. I think you have two main options here:
Use
mod_offline_post
module which will sendPOST
request on given url. Then you can use any existing backend language to process both apns and gcm (I am using rails as backend anyway so this is only one more enpoint to handle it).Based on
mod_offline_post
, create your own module which will send push notifications instead ofPOST
request. There are few examples and libraries which implements apns and gcm. I.e. apns4erl for apns and this code for gcm. But for that of course it would be good to know some erlang.
Solution 3
AFAIK there is no public ejabberd module that provides an interface to GCM or APN.
I suggest you to implement a custom module with an ejabberd_hook. You can see an example of ejabberd internal module and presence hook here.
If you want to forward messages to offline users I suggest offline_message_hook
while for a generic filtering of messages I suggest filter_packet({From, To, Packet})
and check for packet type (see this stackoverflow question).
Knowing the recipient you can retrieve from the db the device token/registration id and forward the message using some erlang code.
For APN take a look at some simple code explaining how it works or to this erlang ex_apns. If you want more information about APN of if you want a mock server for APN you can read this blog post.
For an example of GCM you can use the example link provided by @Lucas.
vks
Updated on June 14, 2022Comments
-
vks about 2 years
I have integrate chat system in my iOS and Android app using XMPP. I have used ejabberd 2 in the server side. Chatting sytem works fine. I want to integrate push notification in my chating using APNS and GCM. How can I send a push notification with each chat message ? ejabberd 2 has any API or extensions available to implement this feature ?
Help is highly appreciable,
-
Abhishek Chauhan over 10 yearshow are pushing to android offline user ?
-
Tolgay Toklar over 9 yearsHow can I retrieve device token from db ?
-
user601836 over 9 yearsthis depends totally upon how you store tokens and on what db.
-
CoDe over 7 yearsHow to send FCM configuration param to eJabberD from Android client ? I'm using Smack SDK client side. Any suggestion @Mickaël Rémond, vks