@luxonis/visualizer-protobuf 1.9.0 → 2.0.0
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/apps/depthai-visualizer/src/components/Panel.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/Panel.js +7 -6
- package/dist/apps/depthai-visualizer/src/components/Panel.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js +5 -5
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/{ws/Adapter.d.ts → adapter.d.ts} +13 -12
- package/dist/apps/depthai-visualizer/src/connection/adapter.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/{ws/Adapter.js → adapter.js} +19 -15
- package/dist/apps/depthai-visualizer/src/connection/adapter.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts +84 -0
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/communicator.js +110 -0
- package/dist/apps/depthai-visualizer/src/connection/communicator.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts +43 -0
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/connection.js +64 -0
- package/dist/apps/depthai-visualizer/src/connection/connection.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/{BaseConnection.d.ts → foxglove-connection.d.ts} +4 -29
- package/dist/apps/depthai-visualizer/src/connection/foxglove-connection.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/{BaseConnection.js → foxglove-connection.js} +2 -4
- package/dist/apps/depthai-visualizer/src/connection/foxglove-connection.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts +33 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js +114 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.d.ts +2 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.js +6 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts +11 -76
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js +32 -113
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts +3 -3
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.js +3 -0
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/VisualizerContext.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/context/VisualizerContext.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/VisualizerContext.js +1 -1
- package/dist/apps/depthai-visualizer/src/context/VisualizerContext.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/VisualizerFlatContext.d.ts +3 -3
- package/dist/apps/depthai-visualizer/src/context/VisualizerFlatContext.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/VisualizerFlatContext.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.d.ts +4 -3
- package/dist/apps/depthai-visualizer/src/index.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.js +2 -1
- package/dist/apps/depthai-visualizer/src/index.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/constants.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/constants.js +3 -0
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/constants.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/custom.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/custom.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/custom.js +3 -3
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/custom.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.js +3 -0
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/imu/imu.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/imu/imu.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/pointcloud/point-cloud.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/pointcloud/point-cloud.js +5 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/pointcloud/point-cloud.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/color.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/color.js +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/color.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/depth.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/depth.js +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/depth.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/h264.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/h264.js +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/h264.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mjpeg.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mjpeg.js +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mjpeg.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mono.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mono.js +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/video/mono.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js +3 -3
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/message-handler.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/message-handler.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/protobuf.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/protobuf.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/protobuf.js +5 -2
- package/dist/apps/depthai-visualizer/src/messaging/protobuf.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/panels/PointCloudPanel.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/panels/PointCloudPanel.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.d.ts +2 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js +22 -2
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.d.ts +2 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js +21 -2
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js +13 -10
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.d.ts +2 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js +21 -2
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.d.ts +14 -36
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js +103 -280
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js +3 -0
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/compatibility.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/compatibility.js +3 -0
- package/dist/apps/depthai-visualizer/src/utils/compatibility.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/encoding.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/encoding.js +3 -0
- package/dist/apps/depthai-visualizer/src/utils/encoding.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js +3 -0
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js.map +1 -1
- package/dist/{worker-utils-Jii8lIsy.js → communicator-D_EeiIbd.js} +1997 -3432
- package/dist/{index-DSLjhjen.js → index-Al0pDnqr.js} +4 -2
- package/dist/{index-Bay9MnxH.js → index-BOSrUvKZ.js} +4 -2
- package/dist/{index-DKfQ_S8i.js → index-BeQsiPfT.js} +4 -2
- package/dist/{index-B8Cado6g.js → index-BfF6NM_p.js} +4 -2
- package/dist/{index-BkQgkjmO.js → index-BtdqjdG0.js} +4 -2
- package/dist/{index-2SFix7KY.js → index-By94udNp.js} +4 -2
- package/dist/{index-BEcWpcB1.js → index-CgoOLCnB.js} +5 -3
- package/dist/{index-B8FQDMoh.js → index-CnbrHWCd.js} +4 -2
- package/dist/{index-7n6fnp2B.js → index-D-Et9RVh.js} +4 -2
- package/dist/{index-BvNZUlo_.js → index-D0vwBTE3.js} +4 -2
- package/dist/{index-CNWGMhCW.js → index-DQCAxiet.js} +255 -179
- package/dist/{index-GbwWdY6w.js → index-DpXY8ing.js} +4 -2
- package/dist/{index-otpYhpPx.js → index-DudYiuIt.js} +4 -2
- package/dist/{index-B8t-Gi4x.js → index-FOw7-sDA.js} +4 -2
- package/dist/{index-Cp3omW6p.js → index-IoSJKto7.js} +5 -3
- package/dist/{index-Dn-E1-20.js → index-M-zdB4A1.js} +4 -2
- package/dist/{index-Bk6p8-al.js → index-QNisWGZ4.js} +4 -2
- package/dist/{index-txFQeh8N.js → index-doJtQKmP.js} +4 -2
- package/dist/{index-ChQWCJEj.js → index-r1jTO4Ay.js} +4 -2
- package/dist/index.js +5 -3
- package/dist/{worker-D2k1TTky.js → worker-1z9jlpUn.js} +2 -1
- package/dist/worker-DNYPTnyn.js +9 -0
- package/dist/worker-utils-BbyBpOVt.js +453 -0
- package/dist/worker-utils-DfViKOHw.js +1332 -0
- package/package.json +2 -1
- package/dist/apps/depthai-visualizer/src/connection/BaseConnection.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/BaseConnection.js.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/Connection.d.ts +0 -12
- package/dist/apps/depthai-visualizer/src/connection/webrtc/Connection.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/Connection.js +0 -79
- package/dist/apps/depthai-visualizer/src/connection/webrtc/Connection.js.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/Adapter.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/Adapter.js.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/Connection.d.ts +0 -11
- package/dist/apps/depthai-visualizer/src/connection/ws/Connection.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/Connection.js +0 -45
- package/dist/apps/depthai-visualizer/src/connection/ws/Connection.js.map +0 -1
package/dist/apps/depthai-visualizer/src/connection/{BaseConnection.d.ts → foxglove-connection.d.ts}
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Time } from "@foxglove/rostime";
|
|
2
2
|
import { MessageEvent, PlayerState, PlayerPresence, PlayerProblem } from "@foxglove/studio-base/players/types";
|
|
3
|
+
import { FoxgloveMessage } from "./communicator.js";
|
|
3
4
|
import { MessageHandler } from "../messaging/message-handler.js";
|
|
4
|
-
import { WebSocketConnectionMessage } from "./ws/Adapter.js";
|
|
5
|
-
import { ProtobufKind } from "../messaging/protobuf.js";
|
|
6
5
|
import { MetricsManager } from "../utils/metrics-manager.js";
|
|
7
6
|
export type Metrics = {
|
|
8
7
|
inputFPS: number;
|
|
@@ -14,7 +13,7 @@ declare class ProblemManager {
|
|
|
14
13
|
clearProblems(): void;
|
|
15
14
|
getProblems(): PlayerProblem[];
|
|
16
15
|
}
|
|
17
|
-
declare abstract class FoxgloveConnection {
|
|
16
|
+
export declare abstract class FoxgloveConnection {
|
|
18
17
|
protected listener?: (playerState: PlayerState) => Promise<void>;
|
|
19
18
|
protected id: string;
|
|
20
19
|
protected playerPresence: PlayerPresence;
|
|
@@ -41,35 +40,11 @@ declare abstract class FoxgloveConnection {
|
|
|
41
40
|
setListener(listener: (playerState: PlayerState) => Promise<void>): void;
|
|
42
41
|
getTopicMetrics(topic: string): Metrics;
|
|
43
42
|
protected getCurrentTime(): Time;
|
|
44
|
-
protected onMessagePacket(event: globalThis.MessageEvent<
|
|
43
|
+
protected onMessagePacket(event: globalThis.MessageEvent<FoxgloveMessage>): void;
|
|
45
44
|
protected handleParsedMessage(event: MessageEvent): void;
|
|
46
45
|
protected emitState: (() => void) & {
|
|
47
46
|
currentPromise?: Promise<void>;
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
export type PublicChannelData = {
|
|
51
|
-
topic: string;
|
|
52
|
-
kind: ProtobufKind;
|
|
53
|
-
};
|
|
54
|
-
export type ConnectionEventMap<CustomMessage> = {
|
|
55
|
-
custom: (message: globalThis.MessageEvent<CustomMessage>) => void;
|
|
56
|
-
open: () => void;
|
|
57
|
-
close: () => void;
|
|
58
|
-
channels: (channels: globalThis.MessageEvent<PublicChannelData[]>) => void;
|
|
59
|
-
services: (services: globalThis.MessageEvent<string[]>) => void;
|
|
60
|
-
};
|
|
61
|
-
export type ServiceRequestArgs = {
|
|
62
|
-
name: string;
|
|
63
|
-
timeout?: number;
|
|
64
|
-
body?: Record<string, any>;
|
|
65
|
-
ignoreResponse?: boolean;
|
|
66
|
-
};
|
|
67
|
-
export declare abstract class BaseConnection<CustomMessage = never> extends FoxgloveConnection {
|
|
68
|
-
abstract close(): void;
|
|
69
|
-
abstract on<E extends keyof ConnectionEventMap<CustomMessage>>(name: E, listener: ConnectionEventMap<CustomMessage>[E]): void;
|
|
70
|
-
abstract off<E extends keyof ConnectionEventMap<CustomMessage>>(name: E, listener: ConnectionEventMap<CustomMessage>[E]): void;
|
|
71
|
-
abstract request(args: ServiceRequestArgs): Promise<DataView | null>;
|
|
72
|
-
abstract get connected(): boolean;
|
|
73
|
-
}
|
|
74
49
|
export {};
|
|
75
|
-
//# sourceMappingURL=
|
|
50
|
+
//# sourceMappingURL=foxglove-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foxglove-connection.d.ts","sourceRoot":"","sources":["../../../../../src/connection/foxglove-connection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAyC,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EAEd,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAwB,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,cAAM,cAAc;IAClB,SAAS,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAElC,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;I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hF,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IASxD,SAAS,CAAC,SAAS;;MAwDhB;CACJ"}
|
package/dist/apps/depthai-visualizer/src/connection/{BaseConnection.js → foxglove-connection.js}
RENAMED
|
@@ -19,7 +19,7 @@ class ProblemManager {
|
|
|
19
19
|
return this.problems;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
class FoxgloveConnection {
|
|
22
|
+
export class FoxgloveConnection {
|
|
23
23
|
listener;
|
|
24
24
|
id;
|
|
25
25
|
// player options
|
|
@@ -119,6 +119,4 @@ class FoxgloveConnection {
|
|
|
119
119
|
await this.listener(newPlayerState);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=BaseConnection.js.map
|
|
122
|
+
//# sourceMappingURL=foxglove-connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foxglove-connection.js","sourceRoot":"","sources":["../../../../../src/connection/foxglove-connection.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAQ,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAGL,cAAc,EAEd,kBAAkB,EACnB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAkB,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO7D,MAAM,cAAc;IACR,QAAQ,GAAoB,EAAE,CAAC;IAElC,UAAU,CAAC,OAAsB;QACtC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,aAAa;QACl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AC;CACJ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WebRtcConfig } from "@luxonis/remote-connection";
|
|
2
|
+
import { ServiceCallPayload } from "@foxglove/ws-protocol";
|
|
3
|
+
import { FoxgloveCommunicator, FoxgloveAdapterInputMessage, FoxgloveAdapterOutputMessage } from "../communicator.js";
|
|
4
|
+
export declare class WebRtcWorker extends FoxgloveCommunicator {
|
|
5
|
+
#private;
|
|
6
|
+
protected send: (message: FoxgloveAdapterOutputMessage) => void;
|
|
7
|
+
protected sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void;
|
|
8
|
+
protected isReady(): boolean;
|
|
9
|
+
protected sendServiceCallRequest(request: ServiceCallPayload): void;
|
|
10
|
+
protected subscribe(channel: number): number;
|
|
11
|
+
constructor(config: WebRtcConfig, send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void);
|
|
12
|
+
rawSend(channel: 'message' | 'system', data: string): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
callService({ name, serviceCallId, body }: (FoxgloveAdapterInputMessage & {
|
|
15
|
+
type: "call_service";
|
|
16
|
+
})["data"]): void;
|
|
17
|
+
}
|
|
18
|
+
export type WebRtcFoxgloveAdapterInputMessage = Exclude<FoxgloveAdapterInputMessage, {
|
|
19
|
+
type: 'send' | 'open';
|
|
20
|
+
}> | {
|
|
21
|
+
type: 'send';
|
|
22
|
+
data: {
|
|
23
|
+
channel: 'message' | 'system';
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
type: 'open';
|
|
28
|
+
data: {
|
|
29
|
+
config: WebRtcConfig;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function createWebRtcWorkerMessageListener(send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void): (event: MessageEvent<WebRtcFoxgloveAdapterInputMessage>) => Promise<void>;
|
|
33
|
+
//# sourceMappingURL=worker-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/connection/webrtc/worker-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,YAAY,EAAqB,MAAM,4BAA4B,CAAC;AAE3F,OAAO,EAAe,kBAAkB,EAA6E,MAAM,uBAAuB,CAAC;AAEnJ,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAOrH,qBAAa,YAAa,SAAQ,oBAAoB;;IAsElD,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI;IAC/D,SAAS,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;cA3BnF,OAAO,IAAI,OAAO;cAIlB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;cAMzD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;gBAenD,MAAM,EAAE,YAAY,EACV,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;IAS/F,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAO1D,KAAK,IAAI,IAAI;IAIJ,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,IAAS,EACV,EAAE,CAAC,2BAA2B,GAAG;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI;CAG3E;AAED,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,2BAA2B,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,GAAG;IAChH,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,MAAM,EAAE,YAAY,CAAA;KACrB,CAAA;CACF,CAAA;AAED,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,GACzF,CAAC,KAAK,EAAE,YAAY,CAAC,iCAAiC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAoB3E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4
|
+
import { WebRtcClient } from "@luxonis/remote-connection";
|
|
5
|
+
import { FoxgloveCommunicator } from "../communicator.js";
|
|
6
|
+
const MESSAGE_CHANNEL_NAME = "message";
|
|
7
|
+
const SYSTEM_CHANNEL_NAME = "system";
|
|
8
|
+
export class WebRtcWorker extends FoxgloveCommunicator {
|
|
9
|
+
send;
|
|
10
|
+
sendWithTransfer;
|
|
11
|
+
#webrtc;
|
|
12
|
+
#messageChannel = null;
|
|
13
|
+
#systemChannel = null;
|
|
14
|
+
#isReady = false;
|
|
15
|
+
#subscriptionId = 0;
|
|
16
|
+
#createWebRtc(config) {
|
|
17
|
+
this.#webrtc = new WebRtcClient(config);
|
|
18
|
+
}
|
|
19
|
+
#handleMessages() {
|
|
20
|
+
this.#webrtc.on("connection_established", (connection) => {
|
|
21
|
+
connection.on("data_channel", (channel) => {
|
|
22
|
+
// this.#onOpen(); // TODO:
|
|
23
|
+
if (channel.label === MESSAGE_CHANNEL_NAME) {
|
|
24
|
+
this.#messageChannel = channel;
|
|
25
|
+
channel.on("message", async ({ data: { subscriptionId, data } }) => { this.handleGenericMessage(subscriptionId, data); });
|
|
26
|
+
}
|
|
27
|
+
else if (channel.label === SYSTEM_CHANNEL_NAME) {
|
|
28
|
+
this.#systemChannel = channel;
|
|
29
|
+
channel.on("message", async (event) => {
|
|
30
|
+
// TODO: Handle service call responses
|
|
31
|
+
const message = JSON.parse(event.data);
|
|
32
|
+
if (message.op === "advertise") {
|
|
33
|
+
this.handleChannelsAdvertisement(message.channels);
|
|
34
|
+
}
|
|
35
|
+
else if (message.op === 'unadvertise') {
|
|
36
|
+
this.handleChannelsUnadvertisement(message.channelIds);
|
|
37
|
+
}
|
|
38
|
+
else if (message.op === 'advertiseServices') {
|
|
39
|
+
this.handleServicesAdvertisement(message.services);
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
41
|
+
}
|
|
42
|
+
else if (message.op === 'unadvertiseServices') {
|
|
43
|
+
this.handleServicesUnadvertisement(message.serviceIds);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
connection.on("connection_closed", () => {
|
|
49
|
+
// this.#onClose(); // TODO:
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
isReady() {
|
|
54
|
+
return this.#isReady;
|
|
55
|
+
}
|
|
56
|
+
;
|
|
57
|
+
sendServiceCallRequest(request) {
|
|
58
|
+
// TODO: Should be binary
|
|
59
|
+
// https://github.com/foxglove/ws-protocol/blob/main/docs/spec.md#service-call-request
|
|
60
|
+
this.#messageChannel?.sendMessage(JSON.stringify(request));
|
|
61
|
+
}
|
|
62
|
+
subscribe(channel) {
|
|
63
|
+
this.#subscriptionId += 1;
|
|
64
|
+
this.#systemChannel?.sendMessage(JSON.stringify({
|
|
65
|
+
op: 'subscribe',
|
|
66
|
+
subscriptions: [{
|
|
67
|
+
id: this.#subscriptionId,
|
|
68
|
+
channelId: channel
|
|
69
|
+
}]
|
|
70
|
+
}));
|
|
71
|
+
return this.#subscriptionId;
|
|
72
|
+
}
|
|
73
|
+
constructor(config, send, sendWithTransfer) {
|
|
74
|
+
super();
|
|
75
|
+
this.send = send;
|
|
76
|
+
this.sendWithTransfer = sendWithTransfer;
|
|
77
|
+
this.#createWebRtc(config);
|
|
78
|
+
this.#handleMessages();
|
|
79
|
+
}
|
|
80
|
+
// TODO: binary support
|
|
81
|
+
rawSend(channel, data) {
|
|
82
|
+
if (this.isReady()) {
|
|
83
|
+
const target = channel === 'message' ? this.#messageChannel : this.#systemChannel;
|
|
84
|
+
target?.sendMessage(data);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
close() {
|
|
88
|
+
this.#webrtc.dispose("Connection closed");
|
|
89
|
+
}
|
|
90
|
+
callService({ name, serviceCallId, body = {} }) {
|
|
91
|
+
super.callService({ name, serviceCallId, body });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function createWebRtcWorkerMessageListener(send, sendWithTransfer) {
|
|
95
|
+
let webrtcWorker = null;
|
|
96
|
+
return async (event) => {
|
|
97
|
+
const { type, data } = event.data;
|
|
98
|
+
switch (type) {
|
|
99
|
+
case "open":
|
|
100
|
+
webrtcWorker = new WebRtcWorker(data.config, send, sendWithTransfer);
|
|
101
|
+
break;
|
|
102
|
+
case "close":
|
|
103
|
+
webrtcWorker?.close();
|
|
104
|
+
break;
|
|
105
|
+
case "send":
|
|
106
|
+
webrtcWorker?.rawSend(data.channel, data.message);
|
|
107
|
+
break;
|
|
108
|
+
case "call_service":
|
|
109
|
+
webrtcWorker?.callService(data);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=worker-utils.js.map
|
|
@@ -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AG,KAAK,CAAC,IAAI,CAAC;QAElC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,MAAM;gBACT,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBACrE,MAAM;YACR,KAAK,OAAO;gBACV,YAAY,EAAE,KAAK,EAAE,CAAC;gBACtB,MAAM;YACR,KAAK,MAAM;gBACT,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAClD,MAAM;YACR,KAAK,cAAc;gBACjB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;gBAChC,MAAM;QACV,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../../../../src/connection/webrtc/worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4
|
+
import { createWebRtcWorkerMessageListener } from "./worker-utils.js";
|
|
5
|
+
self.addEventListener("message", createWebRtcWorkerMessageListener(self.postMessage.bind(self), self.postMessage.bind(self)));
|
|
6
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../../../src/connection/webrtc/worker.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAEtE,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,iCAAiC,CAChE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAC3B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAC5B,CAAC,CAAA"}
|
|
@@ -1,83 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
schema: string;
|
|
5
|
-
buffer: DataView;
|
|
6
|
-
};
|
|
7
|
-
export type ToWorkerMessage = {
|
|
8
|
-
type: "open";
|
|
9
|
-
data: {
|
|
10
|
-
wsUrl: string;
|
|
11
|
-
};
|
|
12
|
-
} | {
|
|
13
|
-
type: "send";
|
|
14
|
-
data: string | ArrayBuffer | ArrayBufferView;
|
|
15
|
-
} | {
|
|
16
|
-
type: "close";
|
|
17
|
-
data: null;
|
|
18
|
-
} | {
|
|
19
|
-
type: "call_service";
|
|
20
|
-
data: {
|
|
21
|
-
name: string;
|
|
22
|
-
serviceCallId: number;
|
|
23
|
-
body?: Record<string, any>;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export type FromWorkerMessage = {
|
|
27
|
-
type: "open";
|
|
28
|
-
} | {
|
|
29
|
-
type: "close";
|
|
30
|
-
} | {
|
|
31
|
-
type: "reconnect";
|
|
32
|
-
} | {
|
|
33
|
-
type: "error";
|
|
34
|
-
error: unknown;
|
|
35
|
-
} | {
|
|
36
|
-
type: "channels";
|
|
37
|
-
data: PublicChannelData[];
|
|
38
|
-
} | {
|
|
39
|
-
type: "services";
|
|
40
|
-
data: string[];
|
|
41
|
-
} | {
|
|
42
|
-
type: "service_response";
|
|
43
|
-
data: {
|
|
44
|
-
name: string;
|
|
45
|
-
serviceCallId: number;
|
|
46
|
-
} & ({
|
|
47
|
-
ok: true;
|
|
48
|
-
error: null;
|
|
49
|
-
buffer: DataView;
|
|
50
|
-
} | {
|
|
51
|
-
ok: false;
|
|
52
|
-
error: string;
|
|
53
|
-
buffer: null;
|
|
54
|
-
});
|
|
55
|
-
} | {
|
|
56
|
-
type: "message";
|
|
57
|
-
data: WebSocketConnectionMessage;
|
|
58
|
-
} | {
|
|
59
|
-
type: "custom";
|
|
60
|
-
data: any;
|
|
61
|
-
};
|
|
62
|
-
export declare class WsWorker {
|
|
1
|
+
import { ServiceCallPayload } from "@foxglove/ws-protocol";
|
|
2
|
+
import { FoxgloveCommunicator, FoxgloveAdapterInputMessage, FoxgloveAdapterOutputMessage } from "../communicator.js";
|
|
3
|
+
export declare class WsWorker extends FoxgloveCommunicator {
|
|
63
4
|
#private;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
private createClient;
|
|
71
|
-
private getPublicChannels;
|
|
72
|
-
private getPublicServices;
|
|
73
|
-
private handleAdvertisements;
|
|
74
|
-
private handleServiceResponses;
|
|
75
|
-
constructor(wsUrl: string, send: (message: FromWorkerMessage) => void, sendWithTransfer: (message: FromWorkerMessage, transfer: ArrayBuffer[]) => void);
|
|
5
|
+
protected send: (message: FoxgloveAdapterOutputMessage) => void;
|
|
6
|
+
protected sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void;
|
|
7
|
+
protected isReady(): boolean;
|
|
8
|
+
protected sendServiceCallRequest(request: ServiceCallPayload): void;
|
|
9
|
+
protected subscribe(channel: number): number;
|
|
10
|
+
constructor(wsUrl: string, send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void);
|
|
76
11
|
rawSend(data: string | ArrayBuffer | ArrayBufferView): void;
|
|
77
12
|
close(): void;
|
|
78
|
-
callService({ name, serviceCallId, body }: (
|
|
13
|
+
callService({ name, serviceCallId, body }: (FoxgloveAdapterInputMessage & {
|
|
79
14
|
type: "call_service";
|
|
80
15
|
})["data"]): void;
|
|
81
16
|
}
|
|
82
|
-
export declare function createWsWorkerMessageListener(send: (message:
|
|
17
|
+
export declare function createWsWorkerMessageListener(send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void): (event: MessageEvent<FoxgloveAdapterInputMessage>) => Promise<void>;
|
|
83
18
|
//# sourceMappingURL=worker-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAErH,qBAAa,QAAS,SAAQ,oBAAoB;;IAoD9C,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI;IAC/D,SAAS,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;cAfnF,OAAO,IAAI,OAAO;cAIlB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;cAIzD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;gBAKnD,KAAK,EAAE,MAAM,EACH,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;IAmB/F,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI;IAM3D,KAAK,IAAI,IAAI;IAIJ,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,IAAS,EACV,EAAE,CAAC,2BAA2B,GAAG;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI;CAG3E;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,GACzF,CAAC,KAAK,EAAE,YAAY,CAAC,2BAA2B,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
|
|
@@ -1,121 +1,62 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
1
4
|
import { Waterfall } from "hydrated-ws";
|
|
2
5
|
import { FoxgloveClient } from "@foxglove/ws-protocol";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export class WsWorker {
|
|
6
|
+
import { FoxgloveCommunicator } from "../communicator.js";
|
|
7
|
+
export class WsWorker extends FoxgloveCommunicator {
|
|
6
8
|
send;
|
|
7
9
|
sendWithTransfer;
|
|
8
10
|
#ws;
|
|
9
11
|
#client;
|
|
10
|
-
|
|
11
|
-
services = new Map();
|
|
12
|
-
serviceCalls = new Map();
|
|
13
|
-
createWs(url, onReconnect) {
|
|
12
|
+
#createWs(url, onReconnect) {
|
|
14
13
|
this.#ws = new Waterfall(url, FoxgloveClient.SUPPORTED_SUBPROTOCOL, {
|
|
15
14
|
connectionTimeout: 2000,
|
|
16
15
|
retryPolicy: (_attempt) => {
|
|
17
16
|
onReconnect();
|
|
18
17
|
return 1_000;
|
|
19
18
|
},
|
|
20
|
-
factory: (
|
|
21
|
-
const rawWs = new WebSocket(
|
|
19
|
+
factory: (wsUrl) => {
|
|
20
|
+
const rawWs = new WebSocket(wsUrl, FoxgloveClient.SUPPORTED_SUBPROTOCOL);
|
|
22
21
|
rawWs.binaryType = "arraybuffer";
|
|
23
22
|
return rawWs;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
createClient() {
|
|
26
|
+
#createClient() {
|
|
28
27
|
this.#client = new FoxgloveClient({ ws: this.#ws });
|
|
29
|
-
this.#client.on("open", () => this.send({ type: "open" }));
|
|
30
|
-
this.#client.on("close", () => this.send({ type: "close" }));
|
|
31
|
-
this.#client.on("error", (error) => this.send({ type: "error", error }));
|
|
28
|
+
this.#client.on("open", () => { this.send({ type: "open" }); });
|
|
29
|
+
this.#client.on("close", () => { this.send({ type: "close" }); });
|
|
30
|
+
this.#client.on("error", (error) => { this.send({ type: "error", error }); });
|
|
32
31
|
this.#client.on("message", ({ subscriptionId, data }) => {
|
|
33
|
-
|
|
34
|
-
if (subscription) {
|
|
35
|
-
this.sendWithTransfer({
|
|
36
|
-
type: "message",
|
|
37
|
-
data: { ...subscription, buffer: data }
|
|
38
|
-
}, [data.buffer]);
|
|
39
|
-
}
|
|
32
|
+
this.handleGenericMessage(subscriptionId, data);
|
|
40
33
|
});
|
|
41
34
|
}
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
#handleMessages() {
|
|
36
|
+
this.#client.on("advertise", this.handleChannelsAdvertisement.bind(this));
|
|
37
|
+
this.#client.on("unadvertise", this.handleChannelsUnadvertisement.bind(this));
|
|
38
|
+
this.#client.on("advertiseServices", this.handleServicesAdvertisement.bind(this));
|
|
39
|
+
this.#client.on("unadvertiseServices", this.handleServicesUnadvertisement.bind(this));
|
|
40
|
+
this.#client.on("serviceCallResponse", this.handleServiceResponses.bind(this));
|
|
44
41
|
}
|
|
45
|
-
|
|
46
|
-
return
|
|
42
|
+
isReady() {
|
|
43
|
+
return this.#ws.readyState === this.#ws.OPEN;
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for (const channel of channels) {
|
|
52
|
-
const subscriptionId = this.#client.subscribe(channel.id);
|
|
53
|
-
const kind = protobufsBySchema[channel.schemaName]?.kind ?? 'annotations';
|
|
54
|
-
this.subscriptions.set(subscriptionId, {
|
|
55
|
-
topic: channel.topic,
|
|
56
|
-
schema: channel.schemaName,
|
|
57
|
-
kind
|
|
58
|
-
});
|
|
59
|
-
data.push({ topic: channel.topic, kind });
|
|
60
|
-
}
|
|
61
|
-
this.send({ type: "channels", data });
|
|
62
|
-
});
|
|
63
|
-
this.#client.on("unadvertise", (channels) => {
|
|
64
|
-
for (const channel of channels) {
|
|
65
|
-
this.subscriptions.delete(channel);
|
|
66
|
-
}
|
|
67
|
-
const data = this.getPublicChannels();
|
|
68
|
-
this.send({ type: "channels", data });
|
|
69
|
-
});
|
|
70
|
-
this.#client.on("advertiseServices", (advertisedServices) => {
|
|
71
|
-
const data = this.getPublicServices();
|
|
72
|
-
for (const service of advertisedServices) {
|
|
73
|
-
this.services.set(service.name, service);
|
|
74
|
-
data.push(service.name);
|
|
75
|
-
}
|
|
76
|
-
this.send({ type: "services", data });
|
|
77
|
-
});
|
|
78
|
-
this.#client.on("unadvertiseServices", (unadvertisedServices) => {
|
|
79
|
-
for (const unadvertisedService of unadvertisedServices) {
|
|
80
|
-
for (const [name, service] of this.services) {
|
|
81
|
-
if (service.id === unadvertisedService) {
|
|
82
|
-
this.services.delete(name);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const data = this.getPublicServices();
|
|
87
|
-
this.send({ type: "services", data });
|
|
88
|
-
});
|
|
45
|
+
;
|
|
46
|
+
sendServiceCallRequest(request) {
|
|
47
|
+
this.#client.sendServiceCallRequest(request);
|
|
89
48
|
}
|
|
90
|
-
|
|
91
|
-
this.#client.
|
|
92
|
-
const name = this.serviceCalls.get(event.callId) ?? 'unknown';
|
|
93
|
-
this.serviceCalls.delete(event.callId);
|
|
94
|
-
this.sendWithTransfer({
|
|
95
|
-
type: "service_response",
|
|
96
|
-
data: {
|
|
97
|
-
name,
|
|
98
|
-
ok: true,
|
|
99
|
-
serviceCallId: event.callId,
|
|
100
|
-
buffer: event.data,
|
|
101
|
-
error: null
|
|
102
|
-
}
|
|
103
|
-
}, [event.data.buffer]);
|
|
104
|
-
});
|
|
49
|
+
subscribe(channel) {
|
|
50
|
+
return this.#client.subscribe(channel);
|
|
105
51
|
}
|
|
106
52
|
constructor(wsUrl, send, sendWithTransfer) {
|
|
53
|
+
super();
|
|
107
54
|
this.send = send;
|
|
108
55
|
this.sendWithTransfer = sendWithTransfer;
|
|
109
|
-
const onReconnect = () => {
|
|
110
|
-
this.services.clear();
|
|
111
|
-
this.subscriptions.clear();
|
|
112
|
-
send({ type: "reconnect" });
|
|
113
|
-
};
|
|
114
56
|
try {
|
|
115
|
-
this
|
|
116
|
-
this
|
|
117
|
-
this
|
|
118
|
-
this.handleServiceResponses();
|
|
57
|
+
this.#createWs(wsUrl, this.handleReconnect.bind(this));
|
|
58
|
+
this.#createClient();
|
|
59
|
+
this.#handleMessages();
|
|
119
60
|
}
|
|
120
61
|
catch (error) {
|
|
121
62
|
// try-catch is needed to catch `Mixed Content` errors in Chrome, where the client
|
|
@@ -136,29 +77,7 @@ export class WsWorker {
|
|
|
136
77
|
this.#client.close();
|
|
137
78
|
}
|
|
138
79
|
callService({ name, serviceCallId, body = {} }) {
|
|
139
|
-
|
|
140
|
-
if (!service) {
|
|
141
|
-
this.send({
|
|
142
|
-
type: "service_response",
|
|
143
|
-
data: {
|
|
144
|
-
name,
|
|
145
|
-
serviceCallId,
|
|
146
|
-
ok: false,
|
|
147
|
-
error: "Service was not advertised",
|
|
148
|
-
buffer: null
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (this.#ws.readyState === this.#ws.OPEN) {
|
|
154
|
-
this.serviceCalls.set(serviceCallId, name);
|
|
155
|
-
this.#client.sendServiceCallRequest({
|
|
156
|
-
serviceId: service.id,
|
|
157
|
-
callId: serviceCallId,
|
|
158
|
-
encoding: "json",
|
|
159
|
-
data: recordToDataView(body)
|
|
160
|
-
});
|
|
161
|
-
}
|
|
80
|
+
super.callService({ name, serviceCallId, body });
|
|
162
81
|
}
|
|
163
82
|
}
|
|
164
83
|
export function createWsWorkerMessageListener(send, sendWithTransfer) {
|
|
@@ -167,7 +86,7 @@ export function createWsWorkerMessageListener(send, sendWithTransfer) {
|
|
|
167
86
|
const { type, data } = event.data;
|
|
168
87
|
switch (type) {
|
|
169
88
|
case "open":
|
|
170
|
-
wsWorker = new WsWorker(data.wsUrl, send, sendWithTransfer);
|
|
89
|
+
wsWorker = new WsWorker('wsUrl' in data ? data.wsUrl : '', send, sendWithTransfer);
|
|
171
90
|
break;
|
|
172
91
|
case "close":
|
|
173
92
|
wsWorker?.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-utils.js","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"worker-utils.js","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAA6D,MAAM,oBAAoB,CAAC;AAErH,MAAM,OAAO,QAAS,SAAQ,oBAAoB;IAoDpC;IACA;IApDZ,GAAG,CAAa;IAChB,OAAO,CAAkB;IAEzB,SAAS,CAAC,GAAW,EAAE,WAAuB;QAC5C,IAAI,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,qBAAqB,EAAE;YAClE,iBAAiB,EAAE,IAAI;YACvB,WAAW,EAAE,CAAC,QAAgB,EAAE,EAAE;gBAChC,WAAW,EAAE,CAAC;gBACd,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,EAAE,CAAC,KAAK,EAAE,E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|
|
1
|
-
import {
|
|
2
|
-
export declare const ConnectionsProvider: import("react").Provider<
|
|
3
|
-
export declare const useConnections: () =>
|
|
1
|
+
import { VisualizerConnection } from "../connection/connection.js";
|
|
2
|
+
export declare const ConnectionsProvider: import("react").Provider<VisualizerConnection<never>[]>;
|
|
3
|
+
export declare const useConnections: () => VisualizerConnection[];
|
|
4
4
|
//# sourceMappingURL=ConnectionsProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/context/ConnectionsProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectionsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/context/ConnectionsProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAInE,eAAO,MAAM,mBAAmB,yDAAmB,CAAC;AACpD,eAAO,MAAM,cAAc,QAAO,oBAAoB,EAA+B,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
1
4
|
const Context = React.createContext([]);
|
|
2
5
|
export const ConnectionsProvider = Context.Provider;
|
|
3
6
|
export const useConnections = () => React.useContext(Context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionsProvider.js","sourceRoot":"","sources":["../../../../../src/context/ConnectionsProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectionsProvider.js","sourceRoot":"","sources":["../../../../../src/context/ConnectionsProvider.tsx"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAI1D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAyB,EAAE,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,GAA2B,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC"}
|