@mega-yfue/eufy-sdk 0.5.0-beta.45 → 0.5.0-beta.47

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.
@@ -65,6 +65,7 @@ export declare class RtcCommandRouter {
65
65
  private readonly deps;
66
66
  private readonly sessions;
67
67
  private readonly lives;
68
+ private readonly warm;
68
69
  constructor(deps: RtcCommandRouterDeps);
69
70
  dispatchCommand(route: RtcRoute, cmd: Command): Promise<void>;
70
71
  /**
@@ -104,6 +105,24 @@ export declare class RtcCommandRouter {
104
105
  * rejecting unheard.
105
106
  */
106
107
  private bringUp;
108
+ /**
109
+ * Hold a station's command session open: one hold per station, its idle-close ({@link IDLE_CLOSE_MS})
110
+ * suppressed, {@link PORTAL_KEEPALIVE} sent every {@link PORTAL_KEEPALIVE_MS}, and the session dropped
111
+ * on a tick that finds the previous keepalive unechoed. A closed session ends the hold.
112
+ *
113
+ * Answers an idempotent disposer that releases the hold. Throws when no account is logged in.
114
+ */
115
+ keepWarm(route: RtcRoute): () => void;
116
+ /**
117
+ * Bring a station session up for a {@link keepWarm} hold and start its keepalive. A bring-up that fails,
118
+ * or a hold disposed before it completes, clears the hold and arms no timer. Each tick first checks
119
+ * that the hub echoed the previous keepalive, and drops the session when it did not. The keepalive
120
+ * stops when the session closes, which also clears the hold so the next command or `keepWarm`
121
+ * rebuilds cleanly.
122
+ */
123
+ private warmUp;
124
+ /** Stop a hold's keepalive and remove its listeners from the session it watches. */
125
+ private unwatch;
107
126
  private touch;
108
127
  private drop;
109
128
  }
@@ -37,6 +37,8 @@ export interface RtcPeerEvents {
37
37
  /** The command channel went away while the peer itself may still be up. */
38
38
  commandChannelClosed: [];
39
39
  data: [frame: Buffer, linkType: number];
40
+ /** The hub echoed the portal keepalive on the command channel. */
41
+ keepaliveEcho: [];
40
42
  iceCandidate: [candidate: string];
41
43
  iceGatheringComplete: [];
42
44
  connectionState: [state: string];
@@ -93,7 +95,8 @@ export declare class RtcPeer extends EventEmitter<RtcPeerEvents> {
93
95
  private createChannels;
94
96
  /**
95
97
  * Wire one data channel. Every channel feeds the framer once the command channel has opened it; a
96
- * message before that has nothing to reassemble into and is dropped.
98
+ * message before that has nothing to reassemble into and is dropped. The hub's echo of the portal
99
+ * keepalive on the command channel is unframed and surfaces as `keepaliveEcho` instead.
97
100
  */
98
101
  private wireChannel;
99
102
  private addNow;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The portal's data-channel keepalive for an RTC session.
3
+ *
4
+ * {@link PORTAL_KEEPALIVE} is the 36 bytes the portal sends unframed on the data channel — a 20-byte
5
+ * prefix then a bare `XZYH 1139`, no portal packet header — and the hub echoes it. Sent every
6
+ * {@link PORTAL_KEEPALIVE_MS}, it stops the hub idling the session out.
7
+ */
8
+ /** The portal's 36-byte data-channel keepalive: a 20-byte prefix and a bare `XZYH 1139`. */
9
+ export declare const PORTAL_KEEPALIVE: Buffer<ArrayBuffer>;
10
+ /** How often {@link PORTAL_KEEPALIVE} goes out on an RTC session. */
11
+ export declare const PORTAL_KEEPALIVE_MS = 29000;
@@ -35,6 +35,8 @@ export interface RtcSessionEvents {
35
35
  commandData: [frame: Buffer, linkType: number];
36
36
  /** A reassembled live-video frame. */
37
37
  mediaData: [frame: Buffer];
38
+ /** The hub echoed the portal keepalive on the command channel. */
39
+ keepaliveEcho: [];
38
40
  }
39
41
  export declare class RtcSession extends EventEmitter<RtcSessionEvents> {
40
42
  private readonly opts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.5.0-beta.45",
3
+ "version": "0.5.0-beta.47",
4
4
  "description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
5
5
  "license": "Apache-2.0",
6
6
  "author": "mega-yfue",