You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add mod_event_pusher - frontend module for sns and push. (#1414)
* Add mod_event_pusher - frontend module for sns and push.
* Add headline, normal messages to event_pusher events.
* Put mod_http_notification under mod_event_pusher umbrella.
* Fix style-related errors.
* Compress hook declarations in mod_evenet_pusher_hook_translator.
* Fix local includes not to use include_lib with incorrect path.
* Update iq_handler arity of mod_event_pusher_push.
* Fix mod_event_pusher_http_notifications to ignore unknown events.
* Rename new push modules for better consistency.
* Fix link in event pusher-related docs.
* Redirect references to mod_{aws_sns,http_notification,push} to mod_event_pusher.
* Fix mod_event_pusher_push types.
* Implement suggested documentation improvements.
* Get rid of documentation for deprecated push modules.
For anyone still using them, the correct documentation will be pointed
out in startup warnings.
* Update Push tutorial image with new names
Copy file name to clipboardExpand all lines: doc/advanced-configuration/Modules.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,9 +32,6 @@ A module used by SASL X-OAUTH mechanism.
32
32
It provides an API to manage [custom OAuth tokens](../open-extensions/token-reconnection.md).
33
33
It requires [mod_keystore](../modules/mod_keystore.md) as an actual key database.
34
34
35
-
### [mod_aws_sns](../modules/mod_aws_sns.md)
36
-
Allows sending online/offline notifications, chat and groupchat messages as events to [Amazon Simple Notification Service](https://aws.amazon.com/sns/).
37
-
38
35
### [mod_blocking](../modules/mod_blocking.md)
39
36
Implements [XEP-0191: Blocking Command](http://xmpp.org/extensions/xep-0191.html), a simplified interface to privacy lists.
40
37
@@ -59,7 +56,16 @@ Enables the [XEP-0352: Client State Indication](http://xmpp.org/extensions/xep-0
59
56
### [mod_disco](../modules/mod_disco.md)
60
57
Implements [XEP-0030: Service Discovery](http://xmpp.org/extensions/xep-0030.html) for discovering information (capabilities, protocols, features) about other XMPP entities.
Allows sending online/offline notifications, chat and groupchat messages as events to [Amazon Simple Notification Service](https://aws.amazon.com/sns/).
Implements [XEP-0357 Push Notifiactions](https://xmpp.org/extensions/xep-0357.html) to provide push notifications to clients that are temporary unavailable.
This applies to situations such as sending messages or presences to mobile/SMS/email push service, big data, or an analytics service.
65
71
@@ -109,9 +115,6 @@ Implements [XEP-0049 (Private XML Storage)](http://xmpp.org/extensions/xep-0049.
109
115
### [mod_pubsub](../modules/mod_pubsub.md)
110
116
This extension implements [XEP-0060 (Publish-Subscribe)](http://www.xmpp.org/extensions/xep-0060.html). It is a pluggable implementation using behaviours provided by `node_*.erl` and `nodetree_*.erl` modules.
111
117
112
-
### [mod_push](../modules/mod_push.md)
113
-
Implements [XEP-0357 Push Notifiactions](https://xmpp.org/extensions/xep-0357.html) to provide push notifications to clients that are temporary unavailable.
Handles push notifications generated by [mod_pubsub](../modules/mod_pubsub.md)'s `node_push` and passes them to [MongoosePush](https://github.com/esl/MongoosePush) service.
117
120
@@ -143,4 +146,3 @@ Provides support for vCards, as specified in [XEP-0054: vcard-temp](http://xmpp.
143
146
144
147
### [mod_version](../modules/mod_version.md)
145
148
This module provides the functionality specified in [XEP-0092: Software Version](https://xmpp.org/extensions/xep-0092.html).
Copy file name to clipboardExpand all lines: doc/developers-guide/hooks_description.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Selected hooks description
2
2
3
-
This is a brief documentation for a few selected hooks.
4
-
Though hooks & handlers differ in what they are there to do, it is not necessary to describe them all, because the mechanism is general.
3
+
This is a brief documentation for a few selected hooks.
4
+
Though hooks & handlers differ in what they are there to do, it is not necessary to describe them all, because the mechanism is general.
5
5
The following is meant to give you the idea of how hooks work, what they are used for and the various purposes they can serve.
6
6
7
7
@@ -19,7 +19,7 @@ Some rudimentary verification of the stanza is done once it is received from the
19
19
if the identity does not match the contents of the attribute, an error is returned,
20
20
- the recipient JID (`to` attribute) format is verified.
21
21
22
-
The hook is not run for stanzas which do not pass these basic validity checks.
22
+
The hook is not run for stanzas which do not pass these basic validity checks.
23
23
Neither are such stanzas further processed by the server.
24
24
25
25
This hook won't be called for stanzas arriving from a user served by a federated server (i.e. on a server-to-server connection handled by `ejabberd_s2s`) intended for a user served by the relevant ejabberd instance.
@@ -30,7 +30,7 @@ It is handled by the following modules:
30
30
31
31
*`mod_carboncopy` - if the packet being sent is a message, it forwards it to all the user's resources which have carbon copying enabled
32
32
33
-
*`mod_http_notification` - if configured, sends selected messages to an external http service
33
+
*`mod_event_pusher_http` - if configured, sends selected messages to an external http service
34
34
35
35
*`mod_mam` - stores outgoing messages in an archive
`ejabberd_sm` runs this hook once it determines that a routed stanza is a message and while it ordinarily could be delivered, no resource (i.e. device or desktop client application) of its recipient is available online for delivery.
93
93
94
-
The hook is first handled by `mod_offline`, which should store that message in a persistent way until the recipient comes online and the message can be successfully delivered.
94
+
The hook is first handled by `mod_offline`, which should store that message in a persistent way until the recipient comes online and the message can be successfully delivered.
95
95
The handler in `mod_offline` stores the message and returns `stop`, which terminates the call and no more hook handlers are called.
96
96
97
-
If the `mod_offline` handler fails to store the message, we should notify the user that the message could not be stored.
98
-
To this end, there is another handler registered, but with a greater sequence number, so that it is called after `mod_offline`.
97
+
If the `mod_offline` handler fails to store the message, we should notify the user that the message could not be stored.
98
+
To this end, there is another handler registered, but with a greater sequence number, so that it is called after `mod_offline`.
99
99
If `mod_offline` fails, `ejabberd_sm:bounce_offline_message` is called and the user gets their notification.
100
100
101
101
## `remove_user`
@@ -104,7 +104,7 @@ If `mod_offline` fails, `ejabberd_sm:bounce_offline_message` is called and the u
`remove_user` is run by `ejabberd_auth` - the authentication module - when a request is made to remove the user from the database of the server.
107
+
`remove_user` is run by `ejabberd_auth` - the authentication module - when a request is made to remove the user from the database of the server.
108
108
This one is rather complex, since removing a user requires many cleanup operations:
109
109
`mod_last` removes last activity information (xep 0012);
110
110
`mod_mam` removes the user's message archive;
@@ -121,14 +121,14 @@ and `mod_roster` removes the user's roster from database.
121
121
ejabberd_hooks:run(node_cleanup, [Node])
122
122
```
123
123
124
-
`node_cleanup` is run by a mongooseim_cleaner process which subscribes to `nodedown` messages.
124
+
`node_cleanup` is run by a mongooseim_cleaner process which subscribes to `nodedown` messages.
125
125
Currently the hook is run inside a global transaction (via `global:trans/4`).
126
126
127
-
The job of this hook is to remove all processes registered in Mnesia.
128
-
MongooseIM uses Mnesia to store processes through which messages are then routed - like user sessions or server-to-server communication channels - or various handlers, e.g. IQ request handlers.
127
+
The job of this hook is to remove all processes registered in Mnesia.
128
+
MongooseIM uses Mnesia to store processes through which messages are then routed - like user sessions or server-to-server communication channels - or various handlers, e.g. IQ request handlers.
129
129
Those must obviously be removed when a node goes down, and to do this the modules `ejabberd_local`, `ejabberd_s2s`, `ejabberd_sm` and `mod_bosh` register their handlers with this hook.
130
130
131
-
Number of retries for this transaction is set to 1 which means that in some situations the hook may be run on more than one node in the cluster, especially when there is little garbage to clean after the dead node.
131
+
Number of retries for this transaction is set to 1 which means that in some situations the hook may be run on more than one node in the cluster, especially when there is little garbage to clean after the dead node.
132
132
Setting retries to 0 is not good decision as it was observed that in some setups it may abort the transaction on all nodes.
133
133
134
134
## `session_opening_allowed_for_user`
@@ -145,7 +145,7 @@ Handler function are expected to return:
145
145
*`deny` if the JID is not allowed but other handlers should be run
146
146
*`{stop, deny}` if the JID is not allowed but other handlers should **not** be run
147
147
148
-
In the default implementation the hook is not used, built-in user control methods are supported elsewhere.
148
+
In the default implementation the hook is not used, built-in user control methods are supported elsewhere.
149
149
This is the perfect place to plug in custom security control.
This module is a generic interface for event pushing backends.
3
+
It defines a single hook, `push_event/3` that forwards the event to all registered backends.
4
+
Each backend decides how and if to handle the event in its `push_event/2` implementation.
5
+
6
+
The events are standardized as records that can be found in `mod_event_pusher_events.hrl` file.
7
+
Common events like user presence changes (offline and online), chat and groupchat messages (incoming and outgoing) are already hooked up to the frontend via `mod_event_pusher_hook_translator` which is a proxy between various hooks and `push_event/3` hook handler.
8
+
9
+
### Options
10
+
11
+
***backends** (required, list) - Specifies backends to register with the frontend, along with arguments that will be passed to the backend.
12
+
Currently supported backends include [sns], [push] and [http_notification].
13
+
Refer to their specific documentation to learn more about their functions and configuration options.
This module enables forwarding certain events (messages, presence, etc.) via HTTP to external services such as push (by mobile, email or SMS), big data, or analytics services.
3
+
This module is a backend of [mod_event_pusher] that enables forwarding certain events (messages, presence, etc.) via HTTP to external services such as push (by mobile, email or SMS), big data, or analytics services.
4
4
5
5
### How it works
6
6
7
-
The module adds a handler to a `user_send_packet` hook which is triggered every time a user sends anything.
7
+
The module hooks on all packets sent by connected users.
8
8
When the hook is triggered, the module:
9
9
10
-
* checks whether http_notification is enabled (the `host` param is set)
11
10
* runs a callback module's `should_make_req/3` function to see if a notification should be sent
12
11
* sends a POST request composed of `{Host::binary(), Sender::binary(), Receiver::binary(), Message::binary()}` to the http notification server
13
12
14
13
### Callback module
15
14
16
15
To find out what should be sent to the HTTP server, MongooseIM calls `Mod:should_make_req(Packet::xmlel(), From::jid(), To::jid())`.
17
-
By default it uses the function in mod_http_notification itself, which ships all non-empty chat messages and nothing else. The module can be substituted here, the method should return `true | false`.
16
+
By default it uses the function in `mod_event_pusher_http` itself, which ships all non-empty chat messages and nothing else. The module can be substituted here, the method should return `true | false`.
18
17
19
18
## Prerequisites
20
19
21
-
This module uses a connection pool created by mongoose_http_client. It must be defined in `http_connections` settings.
20
+
This module uses a connection pool created by mongoose_http_client. It must be defined in the `http_connections` settings.
22
21
23
22
## Options
24
23
@@ -32,17 +31,29 @@ This module uses a connection pool created by mongoose_http_client. It must be d
0 commit comments