ejabberd and Push Notification

后端 未结 3 901
谎友^
谎友^ 2021-01-31 21:28

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

3条回答
  •  孤城傲影
    2021-01-31 22:16

    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.

提交回复
热议问题