Home/Add Push Notification to iOS Chat with Ejabberd Server

Add Push Notification to iOS Chat with Ejabberd Server

Published On: 29 August 2016.By .
  • Mobile
  • Product & platform Engineering

Why to Use :
Push notification helps the app to notify users regarding occurrence of any new event. Like in Chat Client, if the user is in offline mode or the app is in idle state and gets some new chat(s) then integration of push notification with chat server will make the app more user friendly and supportive. This blog describes steps of integration of push notification to iOS chat client with ejabberd server.
Pre Request :

First of all we need to download that module from git link .




After download we need to put that file it in the ejabberd/src directory
Then run the default compiler. After running defult compiler, system generate .beam file .

Copy generated .beam files from the ebin directory.

Change in configuration file :

We need to add this code in module section:

  address: "gateway.push.apple.com"
  port: 2195
  certfile: "cert.pem"
  keyfile: "key.pem"

and You need to send this stanza to the server over the XMPP connection, to let the server know your client token:

<iq to="YourServer" type="set"> 
  <register xmlns="https://apple.com/push" > 

Compatibility :
Module work fine with Ejabberd 14 and 15.
There is at least one known issue with Ejabberd 16 which can be solved by changing all calls to the xml module by calls to fxml. There is no support for both versions so far.
Literally, you need to change this:

Type = xml:get_tag_attr_s(<<"type">>, Packet),
To this:
Type = fxml:get_tag_attr_s(<<"type">>, Packet),

Related content

We Love Conversations

Say Hello
Go to Top