Stream Management for @xmpp/client
.
Included and enabled in @xmpp/client
.
Supports Node.js and browsers.
When the session is resumed the online
event is not emitted as session resumption is transparent.
However entity.status
is set to online
.
If the session fails to resume, entity will fallback to regular session establishment in which case online
event will be emitted.
- Automatically responds to acks.
- Periodically request acks.
- If server fails to respond, triggers a reconnect.
- On reconnect retry sending the queue
When a stanza is re-sent, a delay element will be added to it.
from
client jidstamp
date/time at which the stanza was meant to be sent
<delay xmlns="urn:xmpp:delay"
from="[email protected]/resource"
stamp="1990-01-01T00:00:00Z"
/>
Indicates that the connection was resumed. When that happens the online
event is not emitted but xmpp.status
will be online
.
const xmpp = client(...);
const {streamManagement} = xmpp;
streamManagement.on('resumed', () => {
console.log("session resumed");
});
Indicates that a stanza failed to send to the server and will not be retried.
const xmpp = client(...);
const {streamManagement} = xmpp;
streamManagement.on('fail', (stanza) => {
console.log("fail to send", stanza.toString());
});
Indicates that a stanza has been acknowledged by the server.
const xmpp = client(...);
const {streamManagement} = xmpp;
streamManagement.on('ack', (stanza) => {
console.log("stanza acknowledge by the server", stanza.toString());
});