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
// > When an <r/> element ("request") is received, the recipient MUST acknowledge it by sending an <a/> element to the sender containing a value of 'h' that is equal to the number of stanzas handled by the recipient of the <r/> element.
// > When a party receives an <a/> element, it SHOULD keep a record of the 'h' value returned as the sequence number of the last handled outbound stanza for the current stream (and discard the previous value).
96
-
sm.outbound=stanza.attrs.h;
135
+
constoldOutbound=sm.outbound;
136
+
for(leti=0;i<stanza.attrs.h-oldOutbound;i++){
137
+
letitem=sm.outbound_q.shift();
138
+
sm.outbound++;
139
+
sm.emit("ack",item.stanza);
140
+
}
97
141
}
98
142
99
143
returnnext();
@@ -105,6 +149,33 @@ export default function streamManagement({
105
149
if(sasl2){
106
150
setupSasl2({ sasl2, sm, failed, resumed });
107
151
}
152
+
153
+
functionrequestAck(){
154
+
clearTimeout(timeoutTimeout);
155
+
if(sm.timeout){
156
+
timeoutTimeout=setTimeout(
157
+
()=>entity.disconnect().catch(()=>{}),
158
+
sm.timeout,
159
+
);
160
+
}
161
+
entity.send(xml("r",{xmlns: NS})).catch(()=>{});
162
+
// Periodically send r to check the connection
163
+
// If a stanza goes out it will cancel this and set a sooner timer
0 commit comments