nexus-fca 3.0.0 → 3.0.1
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/listenMqtt.js +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexus-fca",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Nexus-FCA 3.0 – stable, low-risk Facebook Messenger automation API with integrated secure login (ID / Password / 2FA), adaptive MQTT core, safety orchestration, metrics, and TypeScript support.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
package/src/listenMqtt.js
CHANGED
|
@@ -174,7 +174,10 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
|
174
174
|
const backoff = getBackoffState(ctx);
|
|
175
175
|
if(!ctx._mqttDiag) ctx._mqttDiag = { attempts:0, events:[] };
|
|
176
176
|
ctx._mqttDiag.attempts++;
|
|
177
|
-
log
|
|
177
|
+
// Suppress previously noisy test info log (kept only if verbose flag enabled)
|
|
178
|
+
if (ctx.globalOptions && ctx.globalOptions.verboseMqtt) {
|
|
179
|
+
log.info('listenMqtt', `Starting Nexus MQTT bridge (attempt=${ctx._mqttDiag.attempts}, backoff=${backoff.current||0}ms)`);
|
|
180
|
+
}
|
|
178
181
|
const runPreflight = shouldRunPreflight(ctx);
|
|
179
182
|
if (runPreflight) {
|
|
180
183
|
(async () => {
|
|
@@ -276,7 +279,9 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
|
276
279
|
() => buildStream(options, rawWs, buildProxy()),
|
|
277
280
|
options
|
|
278
281
|
);
|
|
279
|
-
|
|
282
|
+
if (ctx.globalOptions && ctx.globalOptions.verboseMqtt) {
|
|
283
|
+
log.info('listenMqtt', `MQTT bridge dialing ${host}`);
|
|
284
|
+
}
|
|
280
285
|
const mqttClient = ctx.mqttClient;
|
|
281
286
|
global.mqttClient = mqttClient;
|
|
282
287
|
mqttClient.on('error', function (err) {
|
|
@@ -308,7 +313,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
|
308
313
|
mqttClient.on('close', function () {
|
|
309
314
|
ctx.health.onDisconnect();
|
|
310
315
|
if(ctx.health && typeof ctx.health.incFailure === 'function'){ ctx.health.incFailure(); }
|
|
311
|
-
log.warn('listenMqtt', `
|
|
316
|
+
log.warn('listenMqtt', `MQTT bridge socket closed after ${(Date.now()-attemptStartTs)}ms (attempt=${ctx._mqttDiag.attempts}).`);
|
|
312
317
|
if (!ctx.loggedIn) return; // avoid loops if logged out
|
|
313
318
|
if (ctx.globalOptions.autoReconnect) {
|
|
314
319
|
scheduleAdaptiveReconnect(defaultFuncs, api, ctx, globalCallback);
|
|
@@ -317,7 +322,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
|
317
322
|
mqttClient.on('disconnect', function(){
|
|
318
323
|
ctx.health.onDisconnect();
|
|
319
324
|
if(ctx.health && typeof ctx.health.incFailure === 'function'){ ctx.health.incFailure(); }
|
|
320
|
-
log.warn('listenMqtt', `MQTT disconnect event after ${(Date.now()-attemptStartTs)}ms (attempt
|
|
325
|
+
log.warn('listenMqtt', `MQTT bridge disconnect event after ${(Date.now()-attemptStartTs)}ms (attempt=${ctx._mqttDiag.attempts}).`);
|
|
321
326
|
if (!ctx.loggedIn) return;
|
|
322
327
|
if (ctx.globalOptions.autoReconnect) {
|
|
323
328
|
scheduleAdaptiveReconnect(defaultFuncs, api, ctx, globalCallback);
|
|
@@ -326,12 +331,11 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
|
326
331
|
mqttClient.on("connect", function () {
|
|
327
332
|
resetBackoff(backoff);
|
|
328
333
|
ctx.health.onConnect();
|
|
329
|
-
|
|
334
|
+
if (ctx.globalOptions && ctx.globalOptions.verboseMqtt) {
|
|
335
|
+
log.info('listenMqtt', `Nexus MQTT bridge established in ${(Date.now()-attemptStartTs)}ms (attempt=${ctx._mqttDiag.attempts}).`);
|
|
336
|
+
}
|
|
330
337
|
if (ctx.globalSafety) { try { ctx.globalSafety.recordEvent(); } catch(_) {} }
|
|
331
|
-
|
|
332
|
-
logger("Nexus-FCA premium features works only with Nexus-Bot framework(Kidding)", "info");
|
|
333
|
-
process.env.OnStatus = true;
|
|
334
|
-
}
|
|
338
|
+
// Removed test-only premium features banner
|
|
335
339
|
topics.forEach((topicsub) => mqttClient.subscribe(topicsub));
|
|
336
340
|
var topic;
|
|
337
341
|
const queue = {
|