Git Product home page Git Product logo

mod_push's Introduction

mod_push

Note: This project is not maintained anymore. Mainline ejabberd now ships the app server part of XEP-0357.

mod_push implements XEP-0357 (Push) for ejabberd and includes a messaging-focussed app server for the common push notification services. These are

mod_push is a project in the Google Summer of Code 2015 and is still pre-alpha. Please send feedback.

Prerequisites

  • Erlang/OTP 17 or higher
  • If app server backends are used a working starttls configuration is required; by default the certificate set by the 'certfile' option will be used for communication with the push providers
  • for using APNS this OTP fix is needed (see this blog post)
  • for now an ejabberd branch with mod_push-specific modifications is needed

Installation

git clone https://github.com/royneary/mod_push.git
# copy the source code folder to the module sources folder of your ejabberd
# installation (may be different on your machine)
sudo cp -R mod_push /var/spool/jabber/.ejabberd-modules/sources/
# if done right ejabberdctl will list mod_push as available module
ejabberdctl modules_available
# automatically compile and install mod_push
ejabberdctl module_install mod_push 

Important implementation details

mod_push depends on stream management (XEP-0198) stream resumption. A client will only receive push notifications when the server detects a dead TCP connection. After that the server will wait for the client to resume the stream. We call this state "pending" state (a.k.a. zombie state). To enter the pending state clients are expected to close their TCP connection without sending </stream>. They will typically do so in a handler the mobile OS will call before moving the application into background.

Administrators sometimes have to restart XMPP servers. Ejabberd will close all open streams in that event which means that after a restart stream management will no longer notify mod_push about incoming stanzas for the previous push clients. As a solution to this problem mod_push will send a push notification to all previously pending push users after a restart so they can open a new connection. Currently this notification can not be distinguished from a "normal" notification (e.g. one sent in the event of an incoming message). This means a client will typically try to resume the stream which will fail as it does not exist anymore. Then it can start a new stream and re-enable push. Registrations at mod_push's app server will not be affected by server restarts so clients do not need to re-register.

Configuration

stream management

The option resume_timeout for module ejabberd_c2s in the listen-section of ejabberd.yml must be set to a value greater than 0 (default value is 300). This enables stream resumption but the value has no effect on push users since mod_push overwrites this value to keep them pending for a long time.

pubsub configuration

An XEP-0357 app server requires a pubsub service where XMPP servers can publish notifications. The pubsub service needs a dedicated hostname. If the internal app server shall be used, that is mod_push's option backends is not an empty list [], mod_pubsub must be configured to fulfill the requirements of XEP-0357. The push plugin delivered by mod_push takes care of that. For the internal app server nodetree: "virtual" must be set. The push plugin can also be used to provide a pubsub service for external app server, such as Oshiya. In that case nodetree = "tree" must be set.

mod_pubsub:
  host : "push.example.net"
  nodetree : "virtual"
  plugins: 
    - "push"

Note: switching from nodetree = "tree" to nodetree = "virtual" currently causes mod_pubsub crashes. A workaround is to clear the pubsub mnesia tables. This affects all pubsub services on the ejabberd instance.

ejabberdctl debug
mnesia:clear_table(pubsub_node).
mnesia:clear_table(pubsub_state).
mnesia:clear_table(pubsub_index).
mnesia:clear_table(pubsub_subscription).
mnesia:clear_table(pubsub_item).

If you want to allow other XMPP servers to use your app server you need a SRV record in your DNS server:

_xmpp-server._tcp.push.example.net. 86400 IN SRV 5 0 5269 example.net.

XEP-0357 configuration

User-definable options

There are user-definable config options to specify what contents should be in a push notification. You can set default values for them in the mod_push section:

  • include_senders: include the jids of the last message sender and the last subscription sender (default: false)
  • include_message_count: include the number of queued messages (default: true)
  • include_subscription_count: include the number of queued subscription requests (default: true)
  • include_message_bodies: include the message contents (default: false)

example:

mod_push:
  include_senders: true
  include_message_count: true
  include_subscription_count: true

A user can obtain the current push configuration (the server's default configuration if he never changed it) by sending a service discovery info request to his bare jid. The response will contain a form of FORM_TYPE urn:xmpp:push:options.

<iq from='[email protected]' to='[email protected]/Home' id='x13' type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <x xmlns='jabber:x:data' type='result'>
      <field type='hidden' var='FORM_TYPE'><value>urn:xmpp:push:options</value></field>
      <field type='boolean' var='include-senders'><value>0</value></field>
      <field type='boolean' var='include-message-count'><value>1</value></field>
      <field type='boolean' var='include-subscription-count'><value>1</value></field>
      <field type='boolean' var='include-message-bodies'><value>0</value></field>
    </x>
    <identity category='account' type='registered'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='urn:xmpp:push:0'/>
  </query>
</iq>

A can change her configuration by including a form of FORM_TYPE urn:xmpp:push:options into the enable request. Note that this configuration is a per-user configuration that is valid for all resources. To send publish-options which are passed to the pubsub-service when publishing a notification an other form of FORM_TYPE http://jabber.org/protocol/pubsub#publish-options can be included. In this example it contains a secret a pubsub service might require as credential. mod_push's internal app server does require providing the secret obtained during registration.

<iq type='set' to='example.net' id='x42'>                                                
  <enable xmlns='urn:xmpp:push:0' jid='push.example.net' node='v9S+H8VTFgEl'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE'><value>urn:xmpp:push:options</value></field>
      <field var='include-senders'><value>0</value></field>
      <field var='include-message-count'><value>1</value></field>
      <field var='include-message-bodies'><value>0</value></field>
      <field var='include-subscription-count'><value>1</value></field>
    </x>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
      <field var='secret'><value>szLo+l17Q0ZQr2dShnyQiYn/stqicShK</value></field>
    </x>
  </enable>                      
</iq>

mod_push provides in-band configuration although not recommended by XEP-0357. In order to prevent privilege escalation as mentioned in the XEP subsequent enable requests are only allowed to disable options, not enable them. A fresh configuration is only possible after all push-enabled resources have been disabled.

The response to an enable request with configuration form will include those values that have been accepted for the new configuration.

restrict access

The option access_backends allows restricting access to the app server backends using ejabberd's acl feature. access_backends may be defined in the mod_push section. The default value is all. The example configuration only allows local XMPP users to use the app server.

App server configuration

You can set up multiple app server backends for the different push notification services. This is not required, your users can use external app servers too.

Default options

  • certfile: the path to a certificate file (pem format, containing both certificate and private key) used as default for all backends

Common options

  • register_host: the app server host where users can register. Must be a subdomain of the XMPP server hostname or the XMPP server hostname itself. The advantage of choosing the XMPP server hostname is that clients don't have to guess any subdomain (XEP-0357 does not define service discovery for finding app servers).
  • pubsub_host: the pubsub_host of the backend
  • type: apns|gcm|mozilla|ubuntu|wns
  • app_name: the name of the app the backend is configured for, will be send to the user when service discovery is done on the register_host; the default value is "any", but that's only a valid value for backend types that don't require developer credentials, that is ubuntu and mozilla
  • certfile: the path to a certificate file (pem format, containing both certificate and private key) the backend will use for TLS

APNS-specific options

  • certfile: path to a pem file containing the developer's private key and the certificate obtained from Apple during the provisioning procedure

GCM-specific options

  • auth_key: the API key obtained from Google's api console

WNS

  • auth_key: the client secret obtained from Microsoft Developer Center
  • package_sid: the package SID obtained from Microsoft Developer Center

Example configuration

access:
  local_users:
    local: allow

acl:
  local:
    server: "example.net"

modules:
  mod_pubsub:
    host : "push.example.net"
    nodetree : "virtual"
    plugins: 
      - "push"
  
  mod_push:
    include_senders: true
    access_backends: local_users
    certfile: "/etc/ssl/private/example.pem"
    backends:
      -
        type: ubuntu
        register_host: "example.net"
        pubsub_host: "push.example.net"
      -
        type: gcm
        app_name: "chatninja"
        register_host: "example.net"
        pubsub_host: "push.example.net"
        auth_key: "HgeGfbhwplu7F-fjCUf6gBfkauUaq12h0nHazqc" 
      -
        type: apns
        app_name: "chatninja"
        register_host: "example.net"
        pubsub_host: "push.example.net"
        certfile: "/etc/ssl/private/apns_example_app.pem"  

App server usage

Clients can communicate with the app server by sending adhoc requests containing an XEP-0004 data form: These are the available adhoc commands:

  • register-push-apns: register at an APNS backend
  • register-push-gcm: register at a GCM backend
  • register-push-mozilla: register at a Mozilla SimplePush backend
  • register-push-ubuntu: register at an Ubuntu Push backend
  • register-push-wns: register at a WNS backend
  • list-push-registrations: request a list of all registrations of the requesting user
  • unregister-push: delete the user's registrations (all of them or those matching a given list of node names)

Example:

<iq type='set' to='example.net' id='exec1'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='register-push-apns'
           action='execute'>
    <x xmlns='jabber:x:data' type='submit'>
      <field
      var='token'>
        <value>r3qpHKmzZHjYKYbG7yI4fhY+DWKqFZE5ZJEM8P+lDDo=</value>
      </field>
      <field var='device-name'><value>Home</value></field>
    </x>
  </command>
</iq>

There are common fields which a client has to include for every backend type and there are backend-specific fields.

Common fields for the register commands

  • token: the device identifier the client obtained from the push service
  • device-id: a device identifier a client can define explicitly (the jid's resource part will be used otherwise)
  • device-name: an optional name that will be included in the response to the list-push-registrations command

register-push-apns fields

  • token: the base64-encoded binary token obtained from APNS

register-push-ubuntu fields

  • application-id: the app id as registered at Ubuntu's push service

register-push-wns fields

  • token: the channel URI which must be escaped according to RFC 2396, you can use .NET's Uri.EscapeUriString method for that

unregister-push fields

  • device-id: Either device ID or a list of node IDs must be given. If none of these are in the payload, the resource of the from jid will be interpreted as device ID. If both device ID and node list are given, the device ID will be ignored and only registrations matching a node ID in the given list will be removed.
  • nodes: a list of node names; registrations mathing one of them will be removed

register command response

The app server returns the jid of the pubsub host a pubsub node name and a secret. The client can pass those to its XMPP server in the XEP-0357 enable request. Example:

<iq from='example.net' to='[email protected]/home' id='exec1' type='result'>
  <command xmlns='http://jabber.org/protocol/commands' sessionid='2015-06-15T01:05:03.380703Z' node='register-push-apns' status='completed'>
    <x xmlns='jabber:x:data' type='result'>
      <field var='jid'>
        <value>push.example.net</value>
      </field>
      <field var='node'>
        <value>2100994384</value>
      </field>
      <field var='secret'>
        <value>C46JMRFNEixmP1c5lXEUaIGKGVy-sv81</value>
      </field>
    </x>
  </command>
</iq>

unregister command response

When a list of nodes was given in the request, the response contains the list of nodes of the deleted registrations. Example:

<iq from='example.net' to='[email protected]/home' id='exec1' type='result'>
  <command xmlns='http://jabber.org/protocol/commands' sessionid='2015-06-15T01:23:12.836386Z' node='unregister-push' status='completed'>
    <x xmlns='jabber:x:data' type='result'>
      <field type='list-multi' var='nodes'>
        <value>2100994384</value>
      </field>
    </x>
  </command>
</iq>

list registrations

A list of a user's push-enabled clients can be obtained using the list-push-registrations command. This might be important if a push client shall be unregistered without having access to the device anymore. If a client provided a device-name value during registration it is included in the response along with the node name.

<iq from='example.net' to='[email protected]/home' id='exec1' type='result'>
  <command xmlns='http://jabber.org/protocol/commands' sessionid='2015-08-13T16:10:02.489807Z' node='list-push-registrations' status='completed'>
    <x xmlns='jabber:x:data' type='result'>
      <item>
        <field var='device-name'><value>iOS device</value></field>
        <field var='node'><value>2269691389</value></field>
      </item>
      <item>
        <field var='device-name'><value>Ubuntu device</value></field>
        <field var='node'><value>2393247634</value></field>
      </item>
    </x>
  </command>
</iq>

mod_push's People

Contributors

fiete201 avatar weiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mod_push's Issues

mod_push not getting installed in ejabberd server(ProcessOne)

I am trying to install mod_push module into ejabberd(ProcessOne) server. But i got the following compilation errors:

/Users/.ejabberd-modules/sources/mod_push/ebin/mochijson2.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:183: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:267: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:284: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:298: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:432: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:525: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:537: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:574: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:630: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:645: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:674: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:731: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:780: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:824: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:878: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:898: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:922: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:941: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1007: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1032: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1055: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1156: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1171: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1210: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1248: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1276: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1303: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1514: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1572: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1642: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1711: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1796: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1879: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1901: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1973: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2042: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2125: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2148: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2170: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2177: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2222: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2232: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2246: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2256: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2269: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2348: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2364: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2376: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2384: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2394: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2414: syntax error before: '/'
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:31: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:145: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:160: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:163: Warning: type auth_data() is unused
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:171: Warning: type push_backend() is unused
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:172: Warning: type push_registration() is unused
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:246: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:657: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:811: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
/Users/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1221: Warning: variable 'PubsubHost' is unused
/Users/.ejabberd-modules/sources/mod_push/ebin/mod_push_apns.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_apns.erl:251: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_apns.erl:368: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/ebin/mod_push_gcm.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/ebin/mod_push_mozilla.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_mozilla.erl:74: Warning: variable 'DisableArgs' is unused
/Users/.ejabberd-modules/sources/mod_push/ebin/mod_push_ubuntu.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_ubuntu.erl:74: Warning: variable 'DisableArgs' is unused
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_ubuntu.erl:139: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/Users/.ejabberd-modules/sources/mod_push/ebin/mod_push_wns.bea#: error writing file: no such file or directory
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_wns.erl:84: Warning: variable 'DisableArgs' is unused
/Users/.ejabberd-modules/sources/mod_push/src/mod_push_wns.erl:160: Warning: variable 'ReplyHead' is unused
/Users/.ejabberd-modules/sources/mod_push/ebin/node_push.bea#: error writing file: no such file or directory
Error: {compilation_failed,"/Users/.ejabberd-modules/sources/mod_push/src/mochijson2.erl"}

Can any one please specify how to install mod_push.Does ProcessOne ejabberd support this feature? If not supported, how to upgrade to royneary/mod_push, because i already changed configuration file of existing ejabberd server. If i install royneary ejabberd server, which changes i have to made?

client info is registered but notification won't send

Thank you very much for this amazing work!

this module seems very promising however, I couldn't make it work. These are the steps I've done:

  1. downloaded and installed latest version of Erlang from http://www.erlang.org/downloads
    The latest version contains the fix mentioned in https://github.com/processone/otp/commit/45aaefe739c8ea6c33d140d056b94fcf53c3df30 and https://blog.process-one.net/apple-increasing-security-of-push-service-ahead-of-wwdc/
  2. downloaded and installed ejabberd-mod_push_adjustment from: https://github.com/royneary/ejabberd/tree/mod_push_adjustments
  3. changed ejabberd.yml file:
listen: 
  - 
    port: 5222
    module: ejabberd_c2s
    resume_timeout: 300
    stream_management: true

  mod_push:
    include_senders: true
    include_message_count: true
    include_subscription_count: true
    include_message_bodies: true
    access_backends: local_users
    backends:
      -
        type: apns
        app_name: "supDawg"
        register_host: "myserver.com"
        pubsub_host: "push.myserver.com"
        certfile: "/Applications/ejabberd-push/etc/ejabberd/myCertPrivateKeyNoPass.pem"
  mod_pubsub: 
    host: "push.myserver.com"
    nodetree: "virtual"
    access_createnode: pubsub_createnode
    ## reduces resource comsumption, but XEP in compliant
    ignore_pep_from_offline: true
    ## XEP compliant, but increases resource comsumption
    ## ignore_pep_from_offline: false
    last_item_cache: false
    plugins: 
      - "flat"
      - "hometree"
      - "pep" # pep requires mod_caps
      - "push"
  1. I register clients using this iq:

<iq type="set" to="myserver.com"><command xmlns="http://jabber.org/protocol/commands" node="register-push-apns" action="execute"><x xmlns="jabber:x:data" type="submit"><field var="token"><value>mytoken</value></field><field var="device-name"><value></value></field></x></command></iq>

  1. I get this iq:

<iq xmlns="jabber:client" from="myserver.com" to="[email protected]/12123" type="result"><command xmlns="http://jabber.org/protocol/commands" sessionid="2016-02-16T16:09:46.115808Z" node="register-push-apns" status="completed"><x xmlns="jabber:x:data" type="result"><field var="jid"><value>push.myserver.com </value></field><field var="node"><value>123456</value></field><field var="secret"><value>789012</value></field></x></command></iq>

BUT still when I kill my app, I don't get any push notification. I am using development cert file. Does it work with gateway.sandbox.push.apple.com?
Am I doing anything wrong?

Push notifications not sent when stanzas remain unacknowleged

To track my request in #1 (comment)

In addition to push notifications being sent after the TCP connection for a session is broken, can they please also be sent when stanzas remain unacknowleged for some period of time (eg. 30 seconds)? Then we won't have to rely on the client specifically breaking the connection in order to receive push notifications. This matters for Ubuntu where apps are suspended without killing the TCP connections, but also for phones moving out of service areas where TCP would take considerably longer to time out. Relying instead on things like XMPP pings or TCP keepalives would consume battery life unnecessarily when the connection is inactive. XMPP session resume already requires the stanza acknowledgements anyway so there should be no additional cost to this.

Push notification fail after 144 minutes

The timeout is adjusted to a "big" value when a client enter the stream wait state, when this time has passed the message fails and the stream is stopped. From mod_push.erl:

-define(ADJUSTED_RESUME_TIMEOUT, 100*24*60*60).

However ejabberd interprets this number as milliseconds which works out to 144 minutes for the given number. I presume this is not intended. I worked around it by making the number bigger, it has to fit in 32 bits so doing:

-define(ADJUSTED_RESUME_TIMEOUT, 49*24*60*60*1000).

sets it to 49 days which is about the max. How about removing the timeout altogether for the purpose of mod_push and have notifications delivered forever?

Can't register user

I do follow this step
1 Download and build Erlang from http://www.erlang.org/downloads (Version 18.2.1)
2 Clone and build ejabberd from https://github.com/royneary/ejabberd/tree/mod_push_adjustments
3 Clone and install mod_push
4 Config ejabberd.yml like this
mod_pubsub_odbc:
host: "push.example.com"
nodetree: "virtual"
access_createnode: pubsub_createnode
ignore_pep_from_offline: true
last_item_cache: false
plugins:
- "push"
- "flat"
- "hometree"
- "pep" # pep requires mod_caps
mod_push:
include_senders: true
include_message_count: true
include_subscription_count: true
include_message_bodies: true
access_backends: local_users
backends:
-
type: gcm
app_name: "social"
register_host: "example.com"
pubsub_host: "push.example.com"
auth_key : "GCM_AUTH_KEY"

I register clients using this iq:
<iq to="push.example.com" type="set"><command node="register-push-gcm" action="execute" xmlns="http://jabber.org/protocol/commands"><x type="submit" xmlns="jabber:x:data"><field var="token"><value>CLIENT_REGISTER_TOKEN</value></field><field var="device-id"><value>CLIENT_DEVICE_ID</value></field></x></command></iq>

And I get this iq:
<iq to="[email protected]/mobile" from="push.example.com" xmlns="jabber:client" type="error" id="9cbbcu5eqv"><command node="register-push-gcm" xmlns="http://jabber.org/protocol/commands" action="execute"><x xmlns="jabber:x:data" type="submit"><field xmlns="jabber:x:data" var="token"><value xmlns="jabber:x:data">CLIENT_REGISTER_TOKEN</value></field><field xmlns="jabber:x:data" var="device-id"><value xmlns="jabber:x:data">CLIENT_DEVICE_ID</value></field></x></command><error xmlns="jabber:client" type="cancel" code="404"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

How can I fix this problem?

How does it work?

How does xep-0357 works for offline messages for GCM. I believe GCM is itself an XMPP server and on my mobile I checked ping time to be very high (15 minutes on wifi and 28 minutes on mobile network). How is gcm useful for offline messages? The only usecase I can think of is for Android your service which contains the connection is killed frequently and restated after some time disconnecting you.

GCM doesn't seem to work (tested manually)

Hello, related to previous issue, mod_push doesn't seem to send anything to GCM server nor receiving anything from it.

I used Converstations app, connecting to my ejabberd. During connection to my XMPP server, the app received packet as expected and it showed that push server is enabled, as follows:

03-19 19:14:23.893 4212-4238/? D/conversations: [email protected]: Enabling push on server. Received packet: <x xmlns="jabber:x:data" type="result"><field xmlns="jabber:x:data" var="jid"><value xmlns="jabber:x:data">pubsub.domain.tld</value></field><field xmlns="jabber:x:data" var="node"><value xmlns="jabber:x:data">MY_NODE_ID</value></field><field xmlns="jabber:x:data" var="secret"><value xmlns="jabber:x:data">MY_SECRET_VALUE</value></field></x>
03-19 19:14:24.583 4212-4238/? D/conversations: [email protected]: successfully enabled push on server
03-19 19:14:24.583 4212-4238/? D/conversations: [email protected]: Received packet: <iq to="[email protected]/resource" from="[email protected]" xmlns="jabber:client" type="result" id="tbpc3dfmh1"/>
03-19 19:14:24.583 4212-4238/? D/conversations: [email protected]: Packet type: RESULT
03-19 19:15:20.223 4212-4212/? D/conversations: app switched into background

I tried everything to make sure the app is no longer running: shutting the down client, killing the background service, clearing notifications, use CM cleaner, even hibernate the app using Greenify, shutting down the screen, until I'm sure that the app is no longer running (I debug using Android studio, yes it went down as expected, no more activities in debug window). Also the ejabberd showed that connection already lost, as expected:

2016-03-19 19:20:30.470 [info] <0.2346.0>@ejabberd_c2s:fsm_next_state:2436 Waiting for resumption of stream for [email protected]/resource

Then, I tried manually send packet to GCM server:

curl -s "https://android.googleapis.com/gcm/send" -H "Authorization: key=MY_GCM_KEY" -H "Content-Type: application/json" -d '{"to": "MY_DEVICE_TOKEN_ID", "data": {"score": 123}}'
And viola, the App is up and re-connecting to the server, as expected:

03-19 19:24:16.383 6754-6772/? D/conversations: GCM message received @ 108416663
03-19 19:24:17.163 6754-6774/? D/conversations: restoring roster
03-19 19:24:17.173 6754-6754/? D/conversations: update unread count to 0
03-19 19:24:17.183 6754-6754/? D/conversations: gcm push message arrived in service. extras=Bundle[mParcelledData.dataSize=116]
03-19 19:24:17.213 6754-6780/? D/conversations: [email protected]: connecting

Which left to conclusion that ejabberd server didn't send/receive anything from GCM server, any ideas why and how do I check for it? I also tried monitoring the server traffic and no packets to/from GCM server captured.

thank you

No s2s connection found

Hi

I'm new to ejabberd and am still figuring out why I'm getting certain errors and stuff.

I am currently making an iphone app that sends the following stanza to my ejabberd server to register for push notifications

<iq type="set" to="register.server.com" id="id"> <command xmlns="http://jabber.org/protocol/commands" node="register-push-apns" action="execute"> <x xmlns="jabber:x:data" type="submit"> <field var="token"> <value>token retrieved from apple</value> </field> </x> </command> </iq>

However I get the following error back:
<iq xmlns="jabber:client" from="register.server.com" to="[email protected]/resource" type="error" id="id"> <command xmlns="http://jabber.org/protocol/commands" node="register-push-apns" action="execute"> <x xmlns="jabber:x:data" type="submit"> <field var="token"> <value>device token</value> </field> </x> </command> <error code="503" type="cancel"> <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">No s2s connection found </text> </error> </iq>

My configuration is as follows:

mod_pubsub: ##access_createnode: pubsub_createnode db_type: odbc host: "pubsub.@HOST@" nodetree: "virtual" ## reduces resource comsumption, but XEP incompliant ignore_pep_from_offline: true ## XEP compliant, but increases resource comsumption ## ignore_pep_from_offline: false last_item_cache: false plugins: - "flat" - "hometree" - "pep" # pep requires mod_caps - "push" mod_push: include_message_bodies: true include_senders: true access_backends: all backends: - type: apns #app_name: "APPNAME" certfile: "/home/ubuntu/PushCertificates.pem" pubsub_host: "pubsub.@HOST@" register_host: "register.@HOST@"

What exactly does no s2s connection mean and how can I solve this error?

Apns. Notification is not sent.

Ejabbed 16. I use development certificate.
Config:

...
    stream_management: true
    resume_timeout: 300
    resend_on_timeout: true
...
mod_pubsub: 
    host : "pubsub.flash.intellin.ru"
    nodetree : "virtual"
    access_createnode: pubsub_createnode
    plugins: 
      - "flat"
      - "push"
      - "hometree"
      - "pep" 
  mod_push:
    include_senders: true
    include_message_count: true
    include_subscription_count: true
    access_backends: pubsub_createnode
    certfile: "/etc/ejabberd/tls/wss.pem"
    backends:
      -
        type: apns
        app_name: "ru.intellin.hotline.intellin"
        register_host: "flash.intellin.ru"
        pubsub_host: "pubsub.flash.intellin.ru"
        certfile: "------------------aps_final.pem"

Ejabberd debug log:

Success started:

16:51:12.269 [info] added adhoc command handler for app server <<"flash.intellin.ru">>
16:51:12.273 [debug] +++++++++ mod_push_apns:init, certfile = <<"-------/aps_final.pem">>
16:51:12.291 [debug] Supervisor ejabberd_sup started gen_server:start_link({local,'apns_flash.intellin.ru'}, mod_push_apns, [undefined,undefined,<<"---------aps_final.pem">>], []) at pid <0.476.0>
16:51:12.292 [debug] ++++++++ Added push backends

Register apns:


Received XML on stream = <<"<iq type=\"set\"><enable xmlns=\"urn:xmpp:push:0\" jid=\"pubsub.flash.intellin.ru\" node=\"D9AAAC89-624B-4111-84E5-AB803696EA19\"><x xmlns=\"jabber:x:data\"><field var=\"FORM_TYPE\"><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var=\"token\"><value>a7661c12280c73edb3e303dcf7949447dbe6e7aa</value></field></x></enable></iq>">>
16:53:57.976 [debug] State: {maxrate,1000,989.5345314956888,1470146037881973}, Size=431
M=426.53609988074635, I=94.874
16:53:57.977 [debug] route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"set">>}],[{xmlel,<<"enable">>,[{<<"xmlns">>,<<"urn:xmpp:push:0">>},{<<"jid">>,<<"pubsub.flash.intellin.ru">>},{<<"node">>,<<"D9AAAC89-624B-4111-84E5-AB803696EA19">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"FORM_TYPE">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"http://jabber.org/protocol/pubsub#publish-options">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"token">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"a7661c12280c73edb3e303dcf7949447dbe6e7aa">>}]}]},{xmlel,<<"field">>,----]}]}]}
16:53:57.977 [debug] local route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"set">>}],[{xmlel,<<...>>,...}]}
16:53:57.977 [debug] session manager
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"set">>}],[{xmlel,<<...>>,...}]}
16:53:57.978 [debug] +++++ ParsedSecret = {result,[undefined]}
16:53:57.978 [debug] +++++ enable: no user found!
16:53:57.978 [debug] +++++ ParseResult = not_found
16:53:57.978 [debug] route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"result">>}],[]}
16:53:57.979 [debug] local route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"resu"...>>}],[]}
16:53:57.979 [debug] session manager
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"resu"...>>}],[]}
16:53:57.979 [debug] sending to process <0.559.0>
16:53:57.979 [debug] Send XML on stream = <<"<iq from='[email protected]' to='[email protected]/chatsecure27345' type='result'/>">>
16:53:57.979 [debug] Send XML on stream = <<"<r xmlns='urn:xmpp:sm:3'/>">>
16:53:58.309 [debug] Received XML on stream = <<"<iq type=\"set\" to=\"flash.intellin.ru\" id=\"ru.intellin.hotline.intellin\"><command xmlns=\"http://jabber.org/protocol/commands\" node=\"register-push-apns\" action=\"execute\"><x xmlns=\"jabber:x:data\" type=\"submit\"><field var=\"token\"><value>20995c2c52e6d761114df8375af1c4f739482863a9af12cf9a9e08b8c19db954</value></field><field var=\"device-name\"><value>Home</value></field></x></command></iq><a xmlns=\"urn:xmpp:sm:3\" h=\"6\"/>">>
16:53:58.310 [debug] State: {maxrate,1000,999.433378179492,1470146038308988}, Size=416
M=415.7644188081125, I=1.078
16:53:58.310 [debug] route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        to {jid,<<>>,<<"flash.intellin.ru">>,<<>>,<<>>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"set">>},{<<"to">>,<<"flash.intellin.ru">>},{<<"id">>,<<"ru.intellin.hotline.intellin">>}],[{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"node">>,<<"register-push-apns">>},{<<"action">>,<<"execute">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"token">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"20995c2c52e6d761114df8375af1c4f739482863a9af12cf9a9e08b8c19db954">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"device-name">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"Home">>}]}]}]}]}]}
16:53:58.310 [debug] local route
        from {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        to {jid,<<>>,<<"flash.intellin.ru">>,<<>>,<<>>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"iq">>,[{<<"type">>,<<"set">>},{<<"to">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...}]}
16:53:58.310 [debug] [email protected]/chatsecure27345 acknowledged 6 of 6 stanzas
16:53:58.311 [debug] About to parse {iq,<<"ru.intellin.hotline.intellin">>,set,<<"http://jabber.org/protocol/commands">>,<<>>,{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"node">>,<<"register-push-apns">>},{<<"action">>,<<"execute">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"token">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"20995c2c52e6d761114df8375af1c4f739482863a9af12cf9a9e08b8c19db954">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"device-name">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"Home">>}]}]}]}]}}...
16:53:58.311 [debug] entering parse_request...
16:53:58.315 [debug] +++++ register_client: found backend
16:53:58.316 [debug] route
        from {jid,<<>>,<<"flash.intellin.ru">>,<<>>,<<>>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"id">>,<<"ru.intellin.hotline.intellin">>},{<<"type">>,<<"result">>}],[{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"sessionid">>,<<"2016-08-02T13:53:58.316143Z">>},{<<"node">>,<<"register-push-apns">>},{<<"status">>,<<"completed">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"result">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"jid">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"pubsub.flash.intellin.ru">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"node">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"10999554424259493740">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"secret">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"13934204912325396107">>}]}]}]}]}]}
16:53:58.316 [debug] local route
        from {jid,<<>>,<<"flash.intellin.ru">>,<<>>,<<>>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"id">>,<<"ru.i"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
16:53:58.317 [debug] session manager
        from {jid,<<>>,<<"flash.intellin.ru">>,<<>>,<<>>,<<"flash.intellin.ru">>,<<>>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"flash.intellin.ru">>,<<"chatsecure27345">>}
        packet {xmlel,<<"iq">>,[{<<"id">>,<<"ru.i"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
16:53:58.317 [debug] sending to process <0.559.0>
16:53:58.317 [debug] Send XML on stream = <<"<iq from='flash.intellin.ru' to='[email protected]/chatsecure27345' id='ru.intellin.hotline.intellin' type='result'><command xmlns='http://jabber.org/protocol/commands' sessionid='2016-08-02T13:53:58.316143Z' node='register-push-apns' status='completed'><x xmlns='jabber:x:data' type='result'><field var='jid'><value>pubsub.flash.intellin.ru</value></field><field var='node'><value>10999554424259493740</value></field><field var='secret'><value>13934204912325396107</value></field></x></command></iq>">>


In mnesia we have:

mnesia:dirty_select(push_user, [{'_',[],['$_']}]).
[{push_user,{<<"test">>,<<"flash.intellin.ru">>},
            [{subscription,<<"chatsecure27345">>,false,
                           <<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,
                           {local_reg,<<"pubsub.flash.intellin.ru">>,undefined}}],
            [{'include-senders',true},
             {'include-message-count',true},
             {'include-subscription-count',true},
             {'include-message-bodies',false}],
            []}]

mnesia:dirty_select(push_registration, [{'_',[],['$_']}]).
 {push_registration,<<"10999554424259493740">>,
                    {<<"test">>,<<"flash.intellin.ru">>},
                    <<"chatsecure27345">>,<<"Home">>,
                    <<219,79,125,229,205,156,231,103,186,119,190,181,215,94,
                      29,127,205,251,229,167,245,...>>,
                    <<"11746962566654245423">>,<<>>,38321730,
                    {1470,146599,438332}}]

Then i close ios application.
Ejabberd log:

17:05:58.135 [debug] Received XML on stream = <<>>
17:05:58.135 [debug] State: {maxrate,1000,956.1566833972819,1470146748526679}, Size=0
M=0.0, I=9608.755
17:05:58.139 [info] Waiting for resumption of stream for [email protected]/chatsecure27345

Then i send the message to [email protected].
Ejabberd log:

17:07:55.975 [debug] Received XML on stream = <<"<message type='chat' id='purplefe26550' to='[email protected]'><active xmlns='http://jabber.org/protocol/chatstates'/><body>erfgewrfgwerqgewrgewrg \t  \t\t\t\t \t \t \t    \t\t  \t   \t\t  \t\t</body></message>">>
17:07:55.976 [debug] route
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<"purplefe26550">>},{<<"to">>,<<"[email protected]">>}],[{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]},{xmlel,<<"body">>,[],[{xmlcdata,<<"erfgewrfgwerqgewrgewrg \t  \t\t\t\t \t \t \t    \t\t  \t   \t\t  \t\t">>}]}]}
17:07:55.976 [debug] local route
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
17:07:55.976 [debug] session manager
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
17:07:55.976 [debug] sending to process <0.626.0>
17:07:56.017 [debug] Received XML on stream = <<"<message type='chat' id='purplefe26551' to='[email protected]'><active xmlns='http://jabber.org/protocol/chatstates'/></message>">>
17:07:56.018 [debug] route
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<"purplefe26551">>},{<<"to">>,<<"[email protected]">>}],[{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]}]}
17:07:56.018 [debug] local route
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...}]}
17:07:56.018 [debug] session manager
        from {jid,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>,<<"admin">>,<<"flash.intellin.ru">>,<<"8775891092885536732579">>}
        to {jid,<<"test">>,<<"flash.intellin.ru">>,<<>>,<<"test">>,<<"flash.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...}]}
17:07:56.018 [debug] sending to process <0.626.0>

Notification is not sent.
What I miss?
Please need help.

Push event for local user, but user is not registered at local app server

I use ejabberd 15 with dev certs for apns.

Config:


...
    stream_management: true
    resume_timeout: 300
    resend_on_timeout: true
...
mod_pubsub: 
    host : "push.flash.intellin.ru"
    nodetree : "virtual"
    access_createnode: pubsub_createnode
    plugins: 
      - "flat"
      - "push"
      - "hometree"
      - "pep" 
  mod_push:
    include_senders: true
    include_message_count: true
    include_subscription_count: true
    access_backends: pubsub_createnode
    certfile: "--------wss.pem"
    backends:
      -
        type: apns
        app_name: "ru.intellin.hotline.intellin"
        register_host: "flash.intellin.ru"
        pubsub_host: "push.flash.intellin.ru"
        certfile: "------------------aps_final.pem"

In mnesia:

mnesia:dirty_select(push_user, [{'_',[],['$_']}]).
[{push_user,{<<"test">>,<<"freeswitch.intellin.ru">>},
            [{subscription,<<"chatsecure27345">>,true,
                           <<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,
                           {local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}],
            [{'include-senders',true},
             {'include-message-count',true},
             {'include-subscription-count',true},
             {'include-message-bodies',false}],
            [{'last-message-sender',<<"[email protected]/7014940389500472212350938932415206807710"...>>},
             {'message-count',3}]}]

mnesia:dirty_select(push_registration, [{'_',[],['$_']}]).
[{push_registration,<<"11757480041623978329">>,
                    {<<"test">>,<<"freeswitch.intellin.ru">>},
                    <<"chatsecure27345">>,<<"Home">>,
                    <<"รงowรฑร5kwยปwWยตuยฎยทk^รŸร™ยท=ร™รฝยผร™รŸ^รญยญ"...>>,
                    <<"5813979049124036481">>,<<>>,96046766,
                    {1470,204379,304657}}]

mnesia:dirty_select(push_backend, [{'_',[],['$_']}]).
[{push_backend,96046766,<<"freeswitch.intellin.ru">>,
               <<"push.freeswitch.intellin.ru">>,apns,
               <<"ru.intellin.hotline.intellin">>,
               [ejabberd@localhost],
               'apns_freeswitch.intellin.ru'}]

Then I close app on ios
Ejabberd log:

09:21:31.880 [debug] Received XML on stream = <<>>
09:21:31.880 [debug] State: {maxrate,1000,997.4535785964104,1470205275891251}, Size=0
M=0.0, I=15989.345
09:21:31.881 [info] Waiting for resumption of stream for [email protected]/chatsecure27345
09:21:31.881 [debug] +++++ dispatch: found push_user
09:21:31.881 [debug] +++++ NewSubscrs = [{subscription,<<"chatsecure27345">>,true,<<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,{local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}]
09:21:31.881 [debug] +++++ dispatch: found subscription
09:21:31.882 [debug] +++++++ adjusting timeout to 8640000

and send message.
Ejabberd log:


09:24:30.040 [debug] Received XML on stream = <<"<message type='chat' id='purple9958c57a' to='[email protected]'><active xmlns='http://jabber.org/protocol/chatstates'/><body>wefwef</body></message>">>
09:24:30.041 [debug] State: {maxrate,1000,65.85948952159313,1470205465288562}, Size=158
M=81.69003189996725, I=4752.344
09:24:30.041 [debug] route
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<"purple9958c57a">>},{<<"to">>,<<"[email protected]">>}],[{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]},{xmlel,<<"body">>,[],[{xmlcdata,<<"wefwef">>}]}]}
09:24:30.042 [debug] local route
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
09:24:30.042 [debug] session manager
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
09:24:30.042 [debug] sending to process <0.550.0>
09:24:30.042 [debug] Recipient of message to bare JID has top priority: [email protected]/chatsecure27345
09:24:30.045 [debug] ++++++++++++ Stored Stanza for {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"freeswitch.intellin.ru">>,<<"chatsecure27345">>}: {xmlel,<<"message">>,[{<<"from">>,<<"[email protected]/7014940389500472212350938932415206807710941962853937282559">>},{<<"to">>,<<"[email protected]">>},{<<"type">>,<<"chat">>},{<<"id">>,<<"purple9958c57a">>}],[{xmlel,<<"archived">>,[{<<"by">>,<<"freeswitch.intellin.ru">>},{<<"xmlns">>,<<"urn:xmpp:mam:tmp">>},{<<"id">>,<<"1470205470042943">>}],[]},{xmlel,<<"stanza-id">>,[{<<"by">>,<<"freeswitch.intellin.ru">>},{<<"xmlns">>,<<"urn:xmpp:sid:0">>},{<<"id">>,<<"1470205470042943">>}],[]},{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]},{xmlel,<<"body">>,[],[{xmlcdata,<<"wefwef">>}]}]}
09:24:30.046 [debug] +++++ dispatch: found push_user
09:24:30.046 [debug] +++++ NewSubscrs = [{subscription,<<"chatsecure27345">>,true,<<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,{local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}]
09:24:30.046 [debug] +++++ dispatch: found subscription
09:24:30.046 [info] push event for local user {<<"test">>,<<"freeswitch.intellin.ru">>}, but user is not registered at local app server

Notification is not sent.
What I miss?
Please need help.

register-push-gcm completed but returned "no user found!"

Hello, I'm having issue with gcm, registration succeeded but i got "no user found!" in log message, is there anything i missed? This is the log:

2016-03-15 05:16:15.937 [debug] <0.779.0>@ejabberd_receiver:process_data:283 Received XML on stream = <<"<iq id=\"gm3vbv0uok\" to=\"xmpp.domain.tld\" type=\"set\" from=\"[email protected]/resource\"><command action=\"execute\" node=\"register-push-gcm\" xmlns=\"http://jabber.org/protocol/commands\"><x type=\"submit\" xmlns=\"jabber:x:data\"><field var=\"token\"><value>cyEy7hdw7DA:APA91bEwS6AQiPGo6W3RBm07FR2u9oWNoC0SYyjc82gs6GGKm3pmaZPWNYcL7jZRoGiOU58BaoBeOejs9gErLI026jlL3Dkh7oWJAwOfeolXbKQMOmbPhntMrsxKdotI_r5i7BCO_Ryr</value></field><field var=\"device-id\"><value>7257ffd0acfa9a38</value></field></x></command></iq>">>
        packet {xmlel,<<"iq">>,[{<<"xml:lang">>,<<"en">>},{<<"id">>,<<"gm3vbv0uok">>},{<<"to">>,<<"xmpp.domain.tld">>},{<<"type">>,<<"set">>},{<<"from">>,<<"[email protected]/resource">>}],[{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"action">>,<<"execute">>},{<<"node">>,<<"register-push-gcm">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"token">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"cyEy7hdw7DA:APA91bEwS6AQiPGo6W3RBm07FR2u9oWNoC0SYyjc82gs6GGKm3pmaZPWNYcL7jZRoGiOU58BaoBeOejs9gErLI026jlL3Dkh7oWJAwOfeolXbKQMOmbPhntMrsxKdotI_r5i7BCO_Ryr">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"device-id">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"7257ffd0acfa9a38">>}]}]}]}]}]}
2016-03-15 05:16:16.015 [debug] <0.429.0>@mod_adhoc:process_adhoc_request:237 About to parse {iq,<<"gm3vbv0uok">>,set,<<"http://jabber.org/protocol/commands">>,<<"en">>,{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"action">>,<<"execute">>},{<<"node">>,<<"register-push-gcm">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"token">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"cyEy7hdw7DA:APA91bEwS6AQiPGo6W3RBm07FR2u9oWNoC0SYyjc82gs6GGKm3pmaZPWNYcL7jZRoGiOU58BaoBeOejs9gErLI026jlL3Dkh7oWJAwOfeolXbKQMOmbPhntMrsxKdotI_r5i7BCO_Ryr">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"device-id">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"7257ffd0acfa9a38">>}]}]}]}]}}...
2016-03-15 05:16:16.016 [debug] <0.618.0>@mod_pubsub:node_action:4174 node_action <<"xmpp.domain.tld">> <<"push">> get_entity_subscriptions [<<"xmpp.domain.tld">>,{jid,<<"account">>,<<"domain.tld">>,<<"resource">>,<<"account">>,<<"domain.tld">>,<<"resource">>}]
2016-03-15 05:16:16.016 [debug] <0.618.0>@mod_pubsub:node_call:4155 node_call <<"push">> get_entity_subscriptions [<<"xmpp.domain.tld">>,{jid,<<"account">>,<<"domain.tld">>,<<"resource">>,<<"account">>,<<"domain.tld">>,<<"resource">>}]
2016-03-15 05:16:16.017 [debug] <0.429.0>@mod_push:register_client:215 +++++ register_client: found backend
        packet {xmlel,<<"iq">>,[{<<"id">>,<<"gm3vbv0uok">>},{<<"type">>,<<"result">>}],[{xmlel,<<"command">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/commands">>},{<<"sessionid">>,<<"2016-03-14T22:16:16.017962Z">>},{<<"node">>,<<"register-push-gcm">>},{<<"status">>,<<"completed">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"result">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"jid">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"xmpp.domain.tld">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"node">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"13895595969827853154">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"secret">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"5739172620165810255">>}]}]}]}]}]}
2016-03-15 05:16:16.019 [debug] <0.780.0>@ejabberd_c2s:send_text:1830 Send XML on stream = <<"<iq from='xmpp.domain.tld' to='[email protected]/resource' id='gm3vbv0uok' type='result'><command xmlns='http://jabber.org/protocol/commands' sessionid='2016-03-14T22:16:16.017962Z' node='register-push-gcm' status='completed'><x xmlns='jabber:x:data' type='result'><field var='jid'><value>xmpp.domain.tld</value></field><field var='node'><value>13895595969827853154</value></field><field var='secret'><value>5739172620165810255</value></field></x></command></iq>">>
2016-03-15 05:16:18.266 [debug] <0.779.0>@ejabberd_receiver:process_data:283 Received XML on stream = <<"<iq id=\"gvbj8k4d07\" type=\"set\" from=\"[email protected]/resource\"><enable node=\"13895595969827853154\" jid=\"xmpp.domain.tld\" xmlns=\"urn:xmpp:push:0\"><x type=\"submit\" xmlns=\"jabber:x:data\"><field var=\"FORM_TYPE\"><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var=\"secret\"><value>5739172620165810255</value></field></x></enable></iq>">>
        packet {xmlel,<<"iq">>,[{<<"xml:lang">>,<<"en">>},{<<"id">>,<<"gvbj8k4d07">>},{<<"type">>,<<"set">>},{<<"from">>,<<"[email protected]/resource">>}],[{xmlel,<<"enable">>,[{<<"xmlns">>,<<"urn:xmpp:push:0">>},{<<"node">>,<<"13895595969827853154">>},{<<"jid">>,<<"xmpp.domain.tld">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}],[{xmlel,<<"field">>,[{<<"var">>,<<"FORM_TYPE">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"http://jabber.org/protocol/pubsub#publish-options">>}]}]},{xmlel,<<"field">>,[{<<"var">>,<<"secret">>}],[{xmlel,<<"value">>,[],[{xmlcdata,<<"5739172620165810255">>}]}]}]}]}]}
2016-03-15 05:16:18.268 [debug] <0.624.0>@mod_push:enable:451 +++++ ParsedSecret = {result,[<<"5739172620165810255">>]}
2016-03-15 05:16:18.268 [debug] <0.624.0>@mod_push:enable:474 +++++ enable: no user found!
2016-03-15 05:16:18.269 [debug] <0.624.0>@mod_push:make_config:1935 +++++ ParseResult = not_found

Re:Warning While Compiling

` erl +sbtu +A0 -noinput -mode minimal -boot start_clean -s erl_compile compile_cmdline -extra mod_push.erl

mod_push.erl:31: Warning: behaviour gen_mod undefined
mod_push.erl:145: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in
Erlang" chapter of the ERTS User's Guide for more information.
mod_push.erl:160: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
mod_push.erl:246: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
mod_push.erl:657: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
mod_push.erl:1221: Warning: variable 'PubsubHost' is unused
`
Giving error while i am compiling mod_push.erl on Ubuntu 16.04

Using client state indication to publish on push notification node.

Currently I am seeing that you are dispatching all packets. If your app is in background you don't need chatstates, you can club presence and dispatch message real time. Is it possible to publish only if you have message as packet (or anything which requires immediate delivery). App will connect and receive presence and chatstates (if they are stored in offline storage).

Mod_push with latest ejabberd

is mod_push will work with https://github.com/processone/ejabberd
or i have to download
https://github.com/royneary/ejabberd

When i configure mod_pubsub for mod_push for internal appserver
nodetree="virtual"
my pubsub for avatar dosent work.it give bad auth error.

Then i try to use oshiya with mod_push to keep avatar publish working but i got error of this

2016-11-10 13:37:18 =CRASH REPORT====
crasher:
initial call: gen:init_it/6
pid: <0.1085.0>
registered_name: []
exception exit: {{function_clause,[{proplists,get_value,[password,<<>>,<<"f23e123f7ced9467084a8921191d4e622030eb7e">>],[{file,"proplists.erl"},{line,226}]},{ejabberd_service,'-init/1-fun-2-',2,[{file,"src/ejabberd_service.erl"},{line,136}]},{lists,foldl,3,[{file,"lists.erl"},{line,1262}]},{ejabberd_service,init,1,[{file,"src/ejabberd_service.erl"},{line,134}]},{p1_fsm,init_it,6,[{file,"src/p1_fsm.erl"},{line,377}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]},[{p1_fsm,init_it,6,[{file,"src/p1_fsm.erl"},{line,392}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
ancestors: [ejabberd_service_sup,ejabberd_sup,<0.601.0>]
messages: []
links: [<0.929.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 987
stack_size: 27
reductions: 622
neighbours:
2016-11-10 13:37:18 =SUPERVISOR REPORT====
Supervisor: {local,ejabberd_service_sup}
Context: child_terminated
Reason: {function_clause,[{proplists,get_value,[password,<<>>,<<"f23e123f7ced9467084a8921191d4e622030eb7e">>],[{file,"proplists.erl"},{line,226}]},{ejabberd_service,'-init/1-fun-2-',2,[{file,"src/ejabberd_service.erl"},{line,136}]},{lists,foldl,3,[{file,"lists.erl"},{line,1262}]},{ejabberd_service,init,1,[{file,"src/ejabberd_service.erl"},{line,134}]},{p1_fsm,init_it,6,[{file,"src/p1_fsm.erl"},{line,377}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
Offender: [{pid,<0.1085.0>},{id,undefined},{mfargs,{ejabberd_service,start_link,undefined}},{restart_type,temporary},{shutdown,1000},{child_type,worker}]

2016-11-10 13:44:25 =CRASH REPORT====
crasher:
initial call: gen:init_it/6
pid: <0.1664.0>
registered_name: []
exception exit: {{function_clause,[{proplists,get_value,[password,<<>>,<<"f1946ad1de97c5ef7a767763ad782e69d227bfe8">>],[{file,"proplists.erl"},{line,226}]},{ejabberd_service,'-init/1-fun-2-',2,[{file,"src/ejabberd_service.erl"},{line,136}]},{lists,foldl,3,[{file,"lists.erl"},{line,1262}]},{ejabberd_service,init,1,[{file,"src/ejabberd_service.erl"},{line,134}]},{p1_fsm,init_it,6,[{file,"src/p1_fsm.erl"},{line,377}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]},[{p1_fsm,init_it,6,[{file,"src/p1_fsm.erl"},{line,392}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
1,1 Top

mod_push and oshiya both not working for me.

plz reply me soon.

Only first message delivered when resuming

When my app goes offline mod_push successfully sends push notifications. However when the app resumes the stream I only get the first stanza.

Any idea what would be causing this or could this be a bug in mod_push?

I've added a portion of my log where 3 messages are send while the stream is waiting for resumption. At the end you see there are 3 stanzas not acknowledged.

ejabberd-log.txt

Any help would be greatly appreciated.

MUC support?

Hi all,

is this module working with multi user chat ?

how mod_push with gcm or apn intract

hello
i trying to have my private push notification service , i started my own xmpp server
now i am trying to send push using your plugin
i am now trying to understand why i have to use gcm
and if i have to use it , dose my messages pass to google ?

ignoring invalid value

Hi,

Trying to enable your mod to use GCM only:

Here's my config:

  mod_push:
    include_senders: true
    include_message_count: true
    include_subscription_count: true
    include_message_bodies: true
    backends:
      -
        type: gcm
        app_name: "**********"
        register_host: "******************************"
        auth_key: "****************************************"

And here's the error:

2016-03-10 23:32:18.371 [error] <0.38.0>@gen_mod:validate_opts:241 ignoring invalid value '[[{type,gcm},{app_name,<<"_">>},{register_host,<<"_">>},{auth_key,<<"******************************">>}]]' for option 'backends' of module 'mod_push'

Errors and Warnings

Getting following errors and warnings when installing this. any help to resolve ?

ubuntu@ip-12-1-6-28:/opt/ejabberd-18.12.1/bin$ sudo ./ejabberdctl module_install mod_push
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:54: can't find include file "jlib.hrl"
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:183: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:258: undefined macro 'ERR_INTERNAL_SERVER_ERROR'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:267: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:284: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:298: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:332: undefined macro 'NS_PUBSUB'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:432: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:442: undefined macro 'ERR_NOT_ACCEPTABLE'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:525: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:537: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:547: undefined macro 'ERR_NOT_ACCEPTABLE'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:574: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:630: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:639: undefined macro 'ERR_INTERNAL_SERVER_ERROR'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:645: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:674: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:731: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:780: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:824: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:851: undefined macro 'NS_XDATA'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:878: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:898: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:922: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:941: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:957: undefined macro 'NS_PUBSUB'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1007: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1032: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1055: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1156: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1171: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1210: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1248: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1276: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1303: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1435: undefined macro 'ERR_FORBIDDEN'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1514: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1526: undefined macro 'ERR_NOT_ALLOWED'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1572: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1642: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1711: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1796: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1879: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1901: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1973: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2042: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2125: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2148: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2170: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2177: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2201: undefined macro 'NS_XDATA'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2222: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2232: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2246: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2256: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2269: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2348: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2358: undefined macro 'NS_XDATA'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2364: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2376: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2384: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2394: syntax error before: '/'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2414: syntax error before: '/'
/opt/ejabberd-18.12.1/lib/ejabberd-18.12.1/include/adhoc.hrl:40: type xmlel() undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:33: function on_affiliation_removal/5 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:33: function process_adhoc_command/4 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:33: function process_iq/3 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:158: type ljid() undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:161: type xmlelement() undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:174: type jid() undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:275: function unregister_client/4 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:294: function unregister_client/4 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:533: function disable/4 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:683: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:684: variable 'LServer' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:684: variable 'LUser' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:691: variable 'LResource' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:697: variable 'LResource' unsafe in 'case' (line 690)
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:775: function do_dispatch_remote/5 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:907: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:909: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1038: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1042: variable 'LServer' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1042: variable 'LUser' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1045: variable 'LResource' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1064: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1079: variable 'Children' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1107: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1604: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1608: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1652: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1655: variable 'RegHost' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1667: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1688: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1688: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1690: function make_config_form/1 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1690: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1693: function make_config_form/1 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1992: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1997: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2001: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2002: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2065: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2067: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2069: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2072: variable 'Children' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2074: variable 'CData' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2074: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2086: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2087: variable 'Attrs' is unbound
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2193: record xmlel undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2197: function get_xdata_elements/2 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2421: record jid undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:31: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:31: Warning: undefined callback function mod_options/1 (behaviour 'gen_mod')
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:145: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:160: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:163: Warning: type auth_data() is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:171: Warning: type push_backend() is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:172: Warning: type push_registration() is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:293: Warning: function unregister_client/3 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:533: Warning: function disable/3 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:657: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:811: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1221: Warning: variable 'PubsubHost' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1663: Warning: variable 'AppName' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:1909: Warning: function make_config/3 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2179: Warning: function remove_subdomain/1 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2190: Warning: function vvaluel/1 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2378: Warning: function boolean_to_binary/1 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2391: Warning: function binary_to_boolean/2 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2402: Warning: function binary_to_boolean/3 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2420: Warning: function ljid_to_jid/1 is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2420: Warning: variable 'LResource' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2420: Warning: variable 'LServer' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl:2420: Warning: variable 'LUser' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_apns.erl:251: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_apns.erl:368: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_mozilla.erl:74: Warning: variable 'DisableArgs' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_ubuntu.erl:74: Warning: variable 'DisableArgs' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_ubuntu.erl:139: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_wns.erl:84: Warning: variable 'DisableArgs' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push_wns.erl:160: Warning: variable 'ReplyHead' is unused
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/node_push.erl:32: can't find include file "jlib.hrl"
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/node_push.erl:147: undefined macro 'ERR_BAD_REQUEST'
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/node_push.erl:37: function publish_item/7 undefined
/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/node_push.erl:34: Warning: undefined callback function get_last_items/3 (behaviour 'gen_pubsub_node')
Error: {compilation_failed,"/opt/ejabberd/.ejabberd-modules/sources/mod_push/src/mod_push.erl"}

Push notifications continue even after session resume

If I start a new session and register for push (Ubuntu), then push notifications aren't sent on incoming messages except after the TCP connection is broken. However, if I then resume the session, then push notifications continue to be sent on incoming messages. I expect push notifications not to be sent at that point.

No test backend

It'd be nice to have a "test" backend that just logs pushes when they are sent out so that it is possible to develop a client independent of dealing with a specific vendor's push API. As a developer, this would be nice because then I could focus on one side at at time, rather than on all components at once.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.