@eryxenx/fca 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/api/socket/listenMqtt.js +19 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eryxenx/fca",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Facebook Chat API by EryXenX | Stable • Auto Re-login • Full E2EE Support — send messages, media, reactions & more in encrypted chats, hassle-free",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -221,7 +221,25 @@ module.exports = function (defaultFuncs, api, ctx, opts) {
|
|
|
221
221
|
function delayedReconnect() {
|
|
222
222
|
const d = conf.reconnectDelayMs;
|
|
223
223
|
logger(`mqtt reconnect in ${d}ms`, "info");
|
|
224
|
-
setTimeout(() =>
|
|
224
|
+
setTimeout(() => refreshSessionAndReconnect(), d);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function refreshSessionAndReconnect() {
|
|
228
|
+
logger("Refreshing session before MQTT reconnection to avoid cookie/dtsg desync", "info");
|
|
229
|
+
defaultFuncs.get("https://www.messenger.com/", ctx.jar, null, ctx)
|
|
230
|
+
.then(() => {
|
|
231
|
+
if (typeof api.refreshFb_dtsg === "function") {
|
|
232
|
+
return api.refreshFb_dtsg().then(() => {
|
|
233
|
+
logger("fb_dtsg refreshed before reconnect", "info");
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
.catch((err) => {
|
|
238
|
+
logger(`Session refresh before reconnect failed (non-fatal): ${err && err.message ? err.message : String(err)}`, "warn");
|
|
239
|
+
})
|
|
240
|
+
.finally(() => {
|
|
241
|
+
getSeqIDWrapper();
|
|
242
|
+
});
|
|
225
243
|
}
|
|
226
244
|
|
|
227
245
|
function forceCycle() {
|