ejabberd

group chat message getting delayed and queued when offline_message_hook is called


group chat message getting delayed and queued when offline_message_hook is called to fire notification. Is there a way to improve this behaviour ?

i created a module to handle APNS notification and called offline_message_hook to fire notification. And the result is the messages distribution in the room are queued and very slowly sending the message when active members sending messages simultaneously, but if i disable the offline_message_hook i can see the messages are distributed to members faster significantly.

Is there a way to improve this vehaviour ?


Solution

  • I also handle APNS notification and called offline_message_hook to fire notification. But i spawn a new process to handle it. Like this:

    spawn(?MODULE, send_notice, [From, To, NewPacket2, Resource]).

    Then the send_notice function post the xmpp packet to a rabbitmq server.