Add Push Notification to iOS Chat with Ejabberd Server
- Digital Engineering
- Mobile
Add Push Notification to iOS Chat with Ejabberd Server
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 .
https://github.com/mrDoctorWho/ejabberd_mod_apns
Implementation:
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:
1 2 3 4 5 |
mod_apns: address: "gateway.push.apple.com" port: 2195 certfile: "cert.pem" keyfile: "key.pem" |
1 2 3 4 5 |
<iq to="YourServer" type="set"> <register xmlns="https://apple.com/push" > <token>TOKEN</token> </register> </iq> |
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:
1 2 3 |
Type = xml:get_tag_attr_s(<<"type">>, Packet), To this: Type = fxml:get_tag_attr_s(<<"type">>, Packet), |
Related content
Auriga: Leveling Up for Enterprise Growth!
Auriga’s journey began in 2010 crafting products for India’s