mod_smacks/README.markdown
author tmolitor <thilo@eightysoft.de>
Sun, 05 Mar 2017 20:23:53 +0100
changeset 2600 ffb6646b4253
parent 2507 7036a6e074d7
child 3971 0957ba6aeb99
permissions -rw-r--r--
Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user Revision 1.5.2 allows sending h-values on resumes that fail due to hibernation timeout and to send out a smacks ack directly before the stream close tag. I also made the used timers stoppable even for prosody 0.10 and below, this makes the smacks-ack-delayed event more useful.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     1
---
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     2
labels:
2158
ada71b81425a mod_smacks/README: Too buggy for a "Beta" label
Kim Alvefur <zash@zash.se>
parents: 2067
diff changeset
     3
- 'Stage-Alpha'
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     4
summary: 'XEP-0198: Reliability and fast reconnects for XMPP'
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     5
...
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
     6
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     7
Introduction
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
     8
============
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
     9
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    10
By default XMPP is as reliable as your network is. Unfortunately in some
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    11
cases that is not very reliable - in some network conditions disconnects
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    12
can be frequent and message loss can occur.
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    13
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    14
To overcome this, XMPP has an optional extension (XEP-0198: Stream
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    15
Management) which, when supported by both the client and server, can
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    16
allow a client to resume a disconnected session, and prevent message
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    17
loss.
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    18
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    19
Details
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    20
=======
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    21
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    22
When using XEP-0198 both the client and the server keep a queue of the
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    23
most recently sent stanzas - this is cleared when the other end
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    24
acknowledges they have received the stanzas. If the client disconnects,
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    25
instead of marking the user offline the server pretends the client is
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    26
still online for a short (configurable) period of time. If the client
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    27
reconnects within this period, any stanzas in the queue that the client
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    28
did not receive are re-sent.
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    29
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    30
If the client fails to reconnect before the timeout then it is marked
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    31
offline as normal, and any stanzas in the queue are returned to the
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    32
sender as a "recipient-unavailable" error.
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    33
2398
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    34
If you don't want this behaviour on timeout you can use [mod_smacks_offline]
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    35
or [mod_smacks_noerror] to customize the behaviour further.
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    36
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    37
This module also provides some events used by [mod_cloud_notify].
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    38
These events are: "smacks-ack-delayed", "smacks-hibernation-start" and
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    39
"smacks-hibernation-end". See [mod_cloud_notify] for details on how this
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    40
events are used there.
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    41
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    42
Use prosody 0.10+ to have per user limits on allowed sessions in hibernation
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    43
state and allowed sessions for which the h-value is kept even after the
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    44
hibernation timed out.
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    45
These are settable using `smacks_max_hibernated_sessions` and `smacks_max_old_sessions`.
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    46
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    47
Configuration
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    48
=============
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    49
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    50
  Option                              Default           Description
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    51
  ----------------------------------  ----------------- ------------------------------------------------------------------------------------------------------------------
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    52
  `smacks_hibernation_time`           300 (5 minutes)   The number of seconds a disconnected session should stay alive for (to allow reconnect)
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    53
  `smacks_enabled_s2s`                false             Enable Stream Management on server connections? *Experimental*
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    54
  `smacks_max_unacked_stanzas`        0                 How many stanzas to send before requesting acknowledgement
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    55
  `smacks_max_ack_delay`              60 (1 minute)     The number of seconds an ack must be unanswered to trigger an "smacks-ack-delayed" event
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    56
  `smacks_max_hibernated_sessions`    10                The number of allowed sessions in hibernated state (limited per user)
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    57
  `smacks_max_old_sessions`           10                The number of allowed sessions with timed out hibernation for which the h-value is still kept (limited per user)
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    58
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    59
Compatibility
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    60
=============
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    61
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    62
  ----- -----------------------------------------------------------------------------
2398
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    63
  0.10  Works
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    64
  0.9   Works, no per user limit of hibernated sessions
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    65
  0.8   Works, no per user limit of hibernated sessions, use version [7693724881b3]
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    66
  ----- -----------------------------------------------------------------------------
1880
9c9397d692aa mod_smacks/README: Update link to 0.8 version
Kim Alvefur <zash@zash.se>
parents: 1807
diff changeset
    67
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    68
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    69
Clients
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    70
=======
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    71
2507
7036a6e074d7 mod_smacks/README: Linkify the XEP
Kim Alvefur <zash@zash.se>
parents: 2398
diff changeset
    72
Clients that support [XEP-0198]:
1786
29f3d6b7ad16 Import wiki pages
Kim Alvefur <zash@zash.se>
parents:
diff changeset
    73
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    74
-   Gajim (Linux, Windows, OS X)
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    75
-   Conversations (Android)
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    76
-   ChatSecure (iOS)
1807
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    77
-   Swift (but not resumption, as of version 2.0 and alphas of 3.0)
4d73a1a6ba68 Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents: 1786
diff changeset
    78
-   Psi (in an unreleased branch)
2600
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    79
-   Yaxim (Android)
ffb6646b4253 Implement XEP-0198 revision 1.5.2 and limit number of hibernated sessions per user
tmolitor <thilo@eightysoft.de>
parents: 2507
diff changeset
    80
-   Monal (iOS)
1880
9c9397d692aa mod_smacks/README: Update link to 0.8 version
Kim Alvefur <zash@zash.se>
parents: 1807
diff changeset
    81
9c9397d692aa mod_smacks/README: Update link to 0.8 version
Kim Alvefur <zash@zash.se>
parents: 1807
diff changeset
    82
[7693724881b3]: //hg.prosody.im/prosody-modules/raw-file/7693724881b3/mod_smacks/mod_smacks.lua
2398
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    83
[mod_smacks_offline]: //modules.prosody.im/mod_smacks_offline
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    84
[mod_smacks_noerror]: //modules.prosody.im/mod_smacks_noerror
4c27ebcf4cbd mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
tmolitor <thilo@eightysoft.de>
parents: 2158
diff changeset
    85
[mod_cloud_notify]: //modules.prosody.im/mod_cloud_notify