@rustwirebot/rustplus.js 2.6.0 → 2.6.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/cli/index.js +14 -0
- package/package.json +1 -1
- package/vendor/push-receiver/client.js +6 -1
package/cli/index.js
CHANGED
|
@@ -205,6 +205,20 @@ async function fcmListen(options) {
|
|
|
205
205
|
const androidId = config.fcm_credentials.gcm.androidId;
|
|
206
206
|
const securityToken = config.fcm_credentials.gcm.securityToken;
|
|
207
207
|
const client = new PushReceiverClient(androidId, securityToken, []);
|
|
208
|
+
|
|
209
|
+
// FIX: previously only ON_DATA_RECEIVED was logged — there was no way to
|
|
210
|
+
// tell whether the connection ever actually succeeded, failed, or was
|
|
211
|
+
// silently retrying. Now all of this is visible.
|
|
212
|
+
client.on('connect', () => {
|
|
213
|
+
console.log('\x1b[32m%s\x1b[0m', `[${new Date().toLocaleString()}] Connected to FCM — waiting for notifications...`);
|
|
214
|
+
});
|
|
215
|
+
client.on('disconnect', () => {
|
|
216
|
+
console.log('\x1b[33m%s\x1b[0m', `[${new Date().toLocaleString()}] Disconnected — retrying...`);
|
|
217
|
+
});
|
|
218
|
+
client.on('error', (err) => {
|
|
219
|
+
console.log('\x1b[31m%s\x1b[0m', `[${new Date().toLocaleString()}] Connection error: ${err?.message || err}`);
|
|
220
|
+
});
|
|
221
|
+
|
|
208
222
|
client.on('ON_DATA_RECEIVED', (data) => {
|
|
209
223
|
|
|
210
224
|
// generate timestamp
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rustwirebot/rustplus.js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "NodeJS library for controlling Smart Switches and interacting with the Rust+ Companion API. Maintained fork of @liamcottle/rustplus.js, republished by BotForge Studios / RustWire.",
|
|
5
5
|
"main": "rustplus.js",
|
|
6
6
|
"bin": {
|
|
@@ -142,10 +142,15 @@ module.exports = class Client extends EventEmitter {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
_onSocketError(error) {
|
|
145
|
-
// ignore, the close handler takes care of
|
|
145
|
+
// FIX: was completely silent ("ignore, the close handler takes care of
|
|
146
|
+
// retry") — this made it impossible to tell whether the connection was
|
|
147
|
+
// failing, retrying, or actually working. Surface it as a proper event
|
|
148
|
+
// so callers (like the CLI) can log what's actually happening.
|
|
149
|
+
this.emit('error', error);
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
_onParserError(error) {
|
|
153
|
+
this.emit('error', error);
|
|
149
154
|
this._retry();
|
|
150
155
|
}
|
|
151
156
|
|