ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

Need help on Push Notifications

Open ismailmohammed opened this issue 8 years ago • 8 comments

Environment

  • ejabberd version: 18.01
  • OS: Windows
  • Installed from: https://www.process-one.net/en/ejabberd/downloads/

Need help on Push Notifications. I am able to get online messages to 1-1 and Group Chat but when a user is offline from a group or for 1-1 then I user should get the offline notifications.

I have added one module for a workaround but I am able to get only 1-1 notifications. which will call a web API which I have written from that Web API using FCM notification will be pushed to users. From some sources, I read that with 18.09 we can get push notifications to Mobile without any modules. Please help me on this where we need to configure this.

Thanks in advance. Regards, Md.Ismail.

ismailmohammed avatar Oct 23 '18 14:10 ismailmohammed

The config template offers a complete setup covering push too: https://github.com/processone/ejabberd/blob/master/ejabberd.yml.example

Try it with 18.09 ;)

licaon-kter avatar Oct 23 '18 14:10 licaon-kter

As I told you before, you have two options (besides modifying ejabberd, e.g. to let groups generate notifications directly):

  1. If you're developing a custom client, you can use the non-standard MUC/Sub extension.
  2. For standard clients, the mod_push_keepalive module tries to work around the issue by keeping the stream management session alive. This will only work if the client does not close the XMPP stream before closing the TCP connection.

weiss avatar Oct 23 '18 14:10 weiss

Thanks for your quick replay,

I have enabled Mod_push_keepalive below is my config file code for this.

mod_push: include_sender: true include_body: true mod_push_keepalive: resume_timeout: 259200 wake_on_start: false wake_on_timeout: true

Please confirm as I was using My SQL DB in my 18.01 version now if I updated Ejabbered 18.01 to 18.09 then do I need to update MY SQL DB also? can you please share me the path from where I can get the update MY SQL DB.

I am using JSXC for my Web application when I sent offline message to apple user in response I received below stanza.

<body xmlns="http://jabber.org/protocol/httpbind"><message xmlns="jabber:client" xml:lang="en" to="[email protected]/20344326581792388601186" from="[email protected]" type="error"><paused xmlns="http://jabber.org/protocol/chatstates"/><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">User session not found</text></error></message></body>

Below is the error which IOS team is getting when they are trying to enable push notification from client,

<iq xmlns=“jabber:client” lang=“en” to=“[email protected]/40AFC2A6-DD77-47C9-A38D-7417BAEC16DA” from=“[email protected]” type=“error” id=“4A6074BD-2947-4468-9D16-15E24C626222"><enable xmlns=“urn:xmpp:push:0” jid=“[email protected]” node=“40AFC2A6-DD77-47C9-A38D-7417BAEC16DA”><x xmlns=“jabber:x:data” type=“submit”><field var=“FORM_TYPE”><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var=“device_id”><value>cfc29fde9bc9d6cc2402ba9be3c775665c3d97279c06c404fdcedb4e76d9a75c</value></field><field var=“topic”><value>com.aud.aa</value></field><field var=“service”><value>apns</value></field><field var=“mode”><value>prod</value></field></x></enable><delay xmlns=“urn:xmpp:delay” stamp=“2018-10-24T06:34:54Z”>Retransmission</delay><error code=“400” type=“modify”><bad-request xmlns=“urn:ietf:params:xml:ns:xmpp-stanzas”/><text xmlns=“urn:ietf:params:xml:ns:xmpp-stanzas” lang=“en”>Too many child elements</text></error></iq>

When iOS application going to background TCP Connection is closed.

Please help us with this thanks in advance, Regards, Md.Ismail.

ismailmohammed avatar Oct 24 '18 06:10 ismailmohammed

Seems the iOS client added this element to the <enable/> IQ:

<delay xmlns=“urn:xmpp:delay” stamp=“2018-10-24T06:34:54Z”>Retransmission</delay>

As per the RFC, this is not permitted for IQ stanzas:

An IQ stanza of type "get" or "set" MUST contain exactly one child element [...].

So ejabberd returns the "Too many child elements" error and doesn't enable push notifications.

weiss avatar Oct 24 '18 10:10 weiss

Hi,

They didn't add this <delay xmlns=“urn:xmpp:delay” stamp=“2018-10-24T06:34:54Z”>Retransmission</delay> to IQ but in response, we are getting this. below is the request IQ which they are sending.

<enable xmlns="urn:xmpp:push:0" jid="[email protected]" node="40AFC2A6-DD77-47C9-A38D-7417BAEC16DA"><x xmlns="jabber:x:data" type="submit"><field var="FORM_TYPE"><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var="device_id"><value>a8dd51cff0f861da1c106a9e81f253951d06b100a4833396f5e274e0fde01082</value></field><field var="topic"><value>com.aa.KConnect</value></field><field var="service"><value>apns</value></field><field var="mode"><value>prod</value></field></x></enable>

Thanks, Md.Ismail.

ismailmohammed avatar Oct 24 '18 12:10 ismailmohammed

They didn't add this <delay xmlns=“urn:xmpp:delay” stamp=“2018-10-24T06:34:54Z”>Retransmission</delay> to IQ

Maybe their library did, I don't know. Either way, it's what ejabberd received and the reason it rejected the IQ.

weiss avatar Oct 24 '18 12:10 weiss

Hi, If you don't please let me know the steps which should follow for push notifications server side and client side. as I am new to it please help me.

  1. I have installed ejabbered 18.09
  2. Ejabbered Yml file changed as per this https://github.com/processone/ejabberd/blob/master/ejabberd.yml.example

what else we need to do from the server side? and what from the client side?

please don't be angry with my questions :)

Regards, Md.Ismail

ismailmohammed avatar Oct 24 '18 13:10 ismailmohammed

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Oct 24 '19 14:10 lock[bot]