@apocaliss92/scrypted-reolink-native 0.1.13 → 0.1.14

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/dist/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apocaliss92/scrypted-reolink-native",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Use any reolink camera with Scrypted, even older/unsupported models without HTTP protocol support",
5
5
  "author": "@apocaliss92",
6
6
  "license": "Apache",
package/src/common.ts CHANGED
@@ -566,6 +566,16 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
566
566
  onClose: async () => {
567
567
  // Reset client state on close
568
568
  // The base class already handles cleanup
569
+ // Resubscribe to events after reconnection
570
+ // Use setTimeout to allow the connection to be re-established first
571
+ setTimeout(async () => {
572
+ try {
573
+ await this.subscribeToEvents();
574
+ } catch (e) {
575
+ const logger = this.getBaichuanLogger();
576
+ logger.warn('Failed to resubscribe to events after reconnection', e);
577
+ }
578
+ }, 1000);
569
579
  },
570
580
  onSimpleEvent: this.onSimpleEvent,
571
581
  getEventSubscriptionEnabled: () => this.isEventDispatchEnabled?.() ?? false,