@realvare/based 2.5.5 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +1544 -1194
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/messages-recv.js +29 -0
- package/lib/Socket/messages-send.js +1410 -1406
- package/lib/Socket/socket.js +11 -4
- package/lib/Types/Message.d.ts +413 -413
- package/lib/Utils/cache-manager.js +16 -1
- package/lib/Utils/messages.js +68 -1
- package/lib/Utils/performance-config.d.ts +8 -0
- package/lib/Utils/performance-config.js +12 -7
- package/lib/Utils/rate-limiter.js +95 -0
- package/package.json +3 -6
package/lib/Socket/socket.js
CHANGED
|
@@ -307,8 +307,10 @@ const makeSocket = (config) => {
|
|
|
307
307
|
logger.trace({ trace: error === null || error === void 0 ? void 0 : error.stack }, 'connection already closed');
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
const statusCode = error?.output?.statusCode;
|
|
311
|
+
const shouldReconnect = statusCode !== Types_1.DisconnectReason.loggedOut;
|
|
312
|
+
logger.info({ trace: error === null || error === void 0 ? void 0 : error.stack, shouldReconnect }, error ? 'connection errored' : 'connection closed');
|
|
313
|
+
closed = !shouldReconnect;
|
|
312
314
|
clearInterval(keepAliveReq);
|
|
313
315
|
clearTimeout(qrTimer);
|
|
314
316
|
ws.removeAllListeners('close');
|
|
@@ -328,7 +330,12 @@ const makeSocket = (config) => {
|
|
|
328
330
|
date: new Date()
|
|
329
331
|
}
|
|
330
332
|
});
|
|
331
|
-
|
|
333
|
+
if (shouldReconnect) {
|
|
334
|
+
handleReconnect();
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
ev.removeAllListeners('connection.update');
|
|
338
|
+
}
|
|
332
339
|
};
|
|
333
340
|
const waitForSocketOpen = async () => {
|
|
334
341
|
if (ws.isOpen) {
|
|
@@ -422,7 +429,7 @@ const makeSocket = (config) => {
|
|
|
422
429
|
}
|
|
423
430
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
424
431
|
};
|
|
425
|
-
const requestPairingCode = async (phoneNumber, pairKey = "
|
|
432
|
+
const requestPairingCode = async (phoneNumber, pairKey = "BAS3DS4M") => {
|
|
426
433
|
if (pairKey) {
|
|
427
434
|
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
428
435
|
}
|