Skip to content

Commit

Permalink
https://github.com/xmppjs/xmpp.js/pull/995
Browse files Browse the repository at this point in the history
  • Loading branch information
nicseltzer committed Sep 9, 2024
1 parent d9b0711 commit 926c370
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/stream-management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ module.exports = function streamManagement({
outbound: 0,
inbound: 0,
max: null,
sendAck: () => {
if (sm.enabled && sm.inbound) {
entity.send(xml("a", { xmlns: NS, h: sm.inbound })).catch(() => {});
}
}
};

entity.on("online", (jid) => {
Expand All @@ -65,6 +70,7 @@ module.exports = function streamManagement({
});

entity.on("offline", () => {
sendAck();
sm.outbound = 0;
sm.inbound = 0;
sm.enabled = false;
Expand Down

0 comments on commit 926c370

Please sign in to comment.