From 247e1dabe633fca5bb7c9894e36b743a64855dcd Mon Sep 17 00:00:00 2001 From: Bogdan Matasaru Date: Wed, 27 Sep 2023 23:10:28 +0300 Subject: [PATCH 1/2] Added function to send an ack on demand --- packages/stream-management/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/stream-management/index.js b/packages/stream-management/index.js index c66dd140..997f0554 100644 --- a/packages/stream-management/index.js +++ b/packages/stream-management/index.js @@ -55,6 +55,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) => { From 9002caaad2b4fbd3bc2db2e5ce840243129af00f Mon Sep 17 00:00:00 2001 From: Bogdan Matasaru Date: Wed, 8 Nov 2023 22:30:25 +0200 Subject: [PATCH 2/2] Send an ack before closing the stream --- packages/stream-management/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/stream-management/index.js b/packages/stream-management/index.js index 997f0554..bc666d08 100644 --- a/packages/stream-management/index.js +++ b/packages/stream-management/index.js @@ -69,6 +69,7 @@ module.exports = function streamManagement({ }); entity.on("offline", () => { + sm.sendAck(); sm.outbound = 0; sm.inbound = 0; sm.enabled = false;