@3dverse/livelink.core 0.7.4 → 0.7.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.
@@ -52,8 +52,9 @@ export declare class GatewayConnection {
52
52
  /**
53
53
  *
54
54
  */
55
- send({ data }: {
55
+ send({ data, is_heart_beat }: {
56
56
  data: ArrayBufferLike | string;
57
+ is_heart_beat?: boolean;
57
58
  }): void;
58
59
  /**
59
60
  *
@@ -4,7 +4,7 @@
4
4
  * See : https://gitlab.com/3dverse/platform/libs/js/asyncapi-server-generator
5
5
  */
6
6
  import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, RemoveFilterMessage, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SessionAuth, SetFilterMessage, SkeletonPoseMessage, ToggleFilterMessage, UpdateEntitiesFromBytesMessage, UpdateEntitiesFromJsonMessage, ViewportConfigs } from "./messages/gateway";
7
- import { UUID, Vec2ui16 } from "../sources/types";
7
+ import { UUID, Vec2ui16, GatewayDisconnectedReason } from "../sources/types";
8
8
  /**
9
9
  * Message handlers interface.
10
10
  * This follows the Livelink protocol specifications for the gateway messages.
@@ -24,7 +24,17 @@ export declare class GatewayMessageHandler extends EventTarget {
24
24
  /**
25
25
  *
26
26
  */
27
- _onDisconnected(): void;
27
+ _onConnected(): void;
28
+ /**
29
+ *
30
+ */
31
+ _onDisconnected({ reason }: {
32
+ reason: GatewayDisconnectedReason;
33
+ }): void;
34
+ /**
35
+ *
36
+ */
37
+ _onMessageSent(is_heart_beat?: boolean): void;
28
38
  /***************************************************************************
29
39
  * AUTHENTICATION (0)
30
40
  **************************************************************************/
@@ -91,6 +91,9 @@ export declare enum InputOperation {
91
91
  touch_pinch_end = 29,
92
92
  headset_move = 30
93
93
  }
94
+ /**
95
+ *
96
+ */
94
97
  export declare enum EditorRemoteOperation {
95
98
  update_config = 0,
96
99
  create_entity = 1,
@@ -1,4 +1,5 @@
1
1
  import type { AssignClientToScriptMessage, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, RemoveFilterMessage, ScreenSpaceRayQuery, ScreenSpaceRayResult, SetFilterMessage, SkeletonPoseMessage, ToggleFilterMessage, UpdateEntitiesFromBytesMessage, UpdateEntitiesFromJsonMessage, ViewportConfigs } from "../_prebuild/messages/gateway";
2
+ import { ActivityWatcher } from "./controllers/ActivityWatcher";
2
3
  import { Serializer } from "./Serializer";
3
4
  import { RTID, UUID, Vec2i } from "./types";
4
5
  import { EntityInterface } from "./interfaces/EntityInterface";
@@ -19,6 +20,10 @@ import { ComponentType } from "./core";
19
20
  */
20
21
  export declare class LivelinkCore {
21
22
  #private;
23
+ /**
24
+ * Get the gateway activity watcher.
25
+ */
26
+ get activity_watcher(): ActivityWatcher;
22
27
  /**
23
28
  * Connect to the session
24
29
  */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Watch activity on the gateway.
3
+ */
4
+ export declare class ActivityWatcher extends EventTarget {
5
+ #private;
6
+ /**
7
+ * Start the timeouts.
8
+ */
9
+ start(): void;
10
+ /**
11
+ * Stop the timeouts if running.
12
+ */
13
+ stop(): void;
14
+ /**
15
+ * Reset the timeouts.
16
+ */
17
+ reset(): void;
18
+ }
@@ -1,5 +1,6 @@
1
1
  import { GatewayMessageHandler } from "../../_prebuild/GatewayMessageHandler";
2
2
  import { SessionInterface } from "../interfaces/SessionInterface";
3
+ import { ActivityWatcher } from "./ActivityWatcher";
3
4
  import { UUID } from "../types";
4
5
  /**
5
6
  * The gateway controller is the exposed interface of the Livelink gateway protocol.
@@ -9,6 +10,10 @@ import { UUID } from "../types";
9
10
  */
10
11
  export declare class GatewayController extends GatewayMessageHandler {
11
12
  #private;
13
+ /**
14
+ *
15
+ */
16
+ get activity_watcher(): ActivityWatcher;
12
17
  /**
13
18
  * Opens a connection to the gateway where the provided session is running.
14
19
  *
@@ -27,4 +32,20 @@ export declare class GatewayController extends GatewayMessageHandler {
27
32
  * Closes the connection to the gateway.
28
33
  */
29
34
  disconnect(): void;
35
+ /**
36
+ *
37
+ */
38
+ _onInactivityTimeout: () => void;
39
+ /**
40
+ *
41
+ */
42
+ _onConnected(): void;
43
+ /**
44
+ *
45
+ */
46
+ _onDisconnected(): void;
47
+ /**
48
+ *
49
+ */
50
+ _onMessageSent(is_heart_beat?: boolean): void;
30
51
  }
@@ -5,3 +5,5 @@ export declare const FTL_EDITOR_ROP_HEADER_SIZE: 25;
5
5
  export declare const LITTLE_ENDIAN: true;
6
6
  export declare const BIG_ENDIAN: false;
7
7
  export declare const HEARTBEAT_PERIOD_IN_MS: 2000;
8
+ export declare const INACTIVITY_WARNING_IN_SEC: 300;
9
+ export declare const INACTIVITY_TIMEOUT_IN_SEC: 360;
@@ -2,3 +2,7 @@ export * from "./math";
2
2
  export * from "./nativeTypes";
3
3
  export * from "./RTID";
4
4
  export * from "./UUID";
5
+ /**
6
+ * The reason why the gateway has disconnected.
7
+ */
8
+ export type GatewayDisconnectedReason = "closed" | "forcibly_closed" | "inactivity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dverse/livelink.core",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "3dverse Livelink Core types.",
5
5
  "main": "./dist/library.cjs",
6
6
  "module": "./dist/library.mjs",