@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
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { aq as styleTags, ar as tags, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aB as foldInside, aH as defineCSSCompletionSource, at as LanguageSupport, av as LRParser, au as ExternalTokenizer } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { aq as styleTags, ar as tags, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aB as foldInside, aH as defineCSSCompletionSource, at as LanguageSupport, av as LRParser, au as ExternalTokenizer } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, ay as syntaxTree, aw as ifNotIn, as as LRLanguage, an as indentNodeProp, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport, aF as IterMode, ax as completeFromList, aG as NodeWeakMap, aE as snippetCompletion } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, ay as syntaxTree, aw as ifNotIn, as as LRLanguage, an as indentNodeProp, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport, aF as IterMode, ax as completeFromList, aG as NodeWeakMap, aE as snippetCompletion } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { ImagePanel } from './index-
|
|
1
|
+
import { ImagePanel } from './index-CgoOLCnB.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'react-dom';
|
|
4
|
-
import './index-
|
|
5
|
-
import './worker-utils-
|
|
4
|
+
import './index-DQCAxiet.js';
|
|
5
|
+
import './worker-utils-DfViKOHw.js';
|
|
6
6
|
import 'hydrated-ws';
|
|
7
7
|
import 'ms';
|
|
8
|
+
import './communicator-D_EeiIbd.js';
|
|
8
9
|
import 'protobufjs/minimal';
|
|
9
10
|
import 'zustand';
|
|
10
11
|
import 'react-mosaic-component';
|
|
11
12
|
import '@mui/material';
|
|
12
13
|
import './i18next-C5Qe4-E1.js';
|
|
14
|
+
import './worker-utils-BbyBpOVt.js';
|
|
13
15
|
import 'react-dnd';
|
|
14
16
|
import 'react-dnd-html5-backend';
|
|
15
17
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aq as styleTags, ar as tags, as as LRLanguage, at as LanguageSupport, au as ExternalTokenizer, av as LRParser, aw as ifNotIn, ax as completeFromList, ay as syntaxTree } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aq as styleTags, ar as tags, as as LRLanguage, at as LanguageSupport, au as ExternalTokenizer, av as LRParser, aw as ifNotIn, ax as completeFromList, ay as syntaxTree } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { as as LRLanguage, an as indentNodeProp, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, aq as styleTags, ar as tags, at as LanguageSupport, av as LRParser } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { as as LRLanguage, an as indentNodeProp, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, aq as styleTags, ar as tags, at as LanguageSupport, av as LRParser } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, ap as foldNodeProp, aB as foldInside, an as indentNodeProp, ao as continuedIndent, aH as defineCSSCompletionSource, at as LanguageSupport } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, ap as foldNodeProp, aB as foldInside, an as indentNodeProp, ao as continuedIndent, aH as defineCSSCompletionSource, at as LanguageSupport } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, aK as html, at as LanguageSupport, aL as parseMixed } from './index-
|
|
2
|
-
import './worker-utils-
|
|
1
|
+
import { au as ExternalTokenizer, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, aK as html, at as LanguageSupport, aL as parseMixed } from './index-DQCAxiet.js';
|
|
2
|
+
import './worker-utils-DfViKOHw.js';
|
|
3
3
|
import 'hydrated-ws';
|
|
4
4
|
import 'ms';
|
|
5
|
+
import './communicator-D_EeiIbd.js';
|
|
5
6
|
import 'protobufjs/minimal';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'zustand';
|
|
8
9
|
import 'react-mosaic-component';
|
|
9
10
|
import '@mui/material';
|
|
10
11
|
import './i18next-C5Qe4-E1.js';
|
|
12
|
+
import './worker-utils-BbyBpOVt.js';
|
|
11
13
|
import 'react-dnd';
|
|
12
14
|
import 'react-dnd-html5-backend';
|
|
13
15
|
import '@emotion/react';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { aR as ImagePanel, aQ as PanelLayout, aS as PointCloudPanel,
|
|
2
|
-
export {
|
|
1
|
+
export { aR as ImagePanel, aQ as PanelLayout, aS as PointCloudPanel, aO as VisualizerConnection, aP as VisualizerContext } from './index-DQCAxiet.js';
|
|
2
|
+
export { b as createWsWorkerMessageListener } from './worker-utils-DfViKOHw.js';
|
|
3
|
+
export { c as createWebRtcWorkerMessageListener } from './worker-utils-BbyBpOVt.js';
|
|
4
|
+
import './communicator-D_EeiIbd.js';
|
|
5
|
+
import 'protobufjs/minimal';
|
|
3
6
|
import 'react';
|
|
4
7
|
import 'zustand';
|
|
5
8
|
import 'react-mosaic-component';
|
|
@@ -18,4 +21,3 @@ import 'react-icons';
|
|
|
18
21
|
import '@pandacss/dev';
|
|
19
22
|
import 'hydrated-ws';
|
|
20
23
|
import 'ms';
|
|
21
|
-
import 'protobufjs/minimal';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as createWsWorkerMessageListener } from './worker-utils-DfViKOHw.js';
|
|
2
2
|
import 'hydrated-ws';
|
|
3
3
|
import 'ms';
|
|
4
|
+
import './communicator-D_EeiIbd.js';
|
|
4
5
|
import 'protobufjs/minimal';
|
|
5
6
|
|
|
6
7
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { c as createWebRtcWorkerMessageListener } from './worker-utils-BbyBpOVt.js';
|
|
2
|
+
import './communicator-D_EeiIbd.js';
|
|
3
|
+
import 'protobufjs/minimal';
|
|
4
|
+
|
|
5
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
8
|
+
|
|
9
|
+
self.addEventListener("message", createWebRtcWorkerMessageListener(self.postMessage.bind(self), self.postMessage.bind(self)));
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import { F as FoxgloveCommunicator } from './communicator-D_EeiIbd.js';
|
|
2
|
+
|
|
3
|
+
class EventEmitter {
|
|
4
|
+
id = 0;
|
|
5
|
+
handlers = {};
|
|
6
|
+
emit(event, data) {
|
|
7
|
+
const handlers = this.handlers[event] ?? [];
|
|
8
|
+
for (const { handler } of handlers) {
|
|
9
|
+
handler(...data);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
on(event, handler) {
|
|
13
|
+
const key = event;
|
|
14
|
+
const id = this.id + 1;
|
|
15
|
+
if (!this.handlers[key]) {
|
|
16
|
+
this.handlers[key] = [];
|
|
17
|
+
}
|
|
18
|
+
this.handlers[key].push({ id, handler });
|
|
19
|
+
return this.off(event, id);
|
|
20
|
+
}
|
|
21
|
+
off(event, id) {
|
|
22
|
+
const key = event;
|
|
23
|
+
if (!this.handlers[key]) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const index = this.handlers[key].findIndex(handler => handler.id === id);
|
|
27
|
+
if (index > 0) {
|
|
28
|
+
this.handlers[key].splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
isEventHandled(event) {
|
|
32
|
+
const eventHandlers = this.handlers[event];
|
|
33
|
+
return !!eventHandlers && Object.values(eventHandlers).length > 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
class WebRtcDataChannel {
|
|
38
|
+
channel;
|
|
39
|
+
events = new EventEmitter();
|
|
40
|
+
oldMessages = [];
|
|
41
|
+
constructor(channel) {
|
|
42
|
+
this.channel = channel;
|
|
43
|
+
this.channel.onerror = event => this.events.emit('error', [event]);
|
|
44
|
+
this.channel.onmessage = event => this.events.emit('message', [event]);
|
|
45
|
+
this.channel.onclose = event => this.events.emit('close', [event]);
|
|
46
|
+
this.channel.onopen = event => {
|
|
47
|
+
this.events.emit('open', [event]);
|
|
48
|
+
for (const message of this.oldMessages) {
|
|
49
|
+
this.sendMessage(message);
|
|
50
|
+
}
|
|
51
|
+
this.oldMessages = [];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
get raw() {
|
|
55
|
+
return this.channel;
|
|
56
|
+
}
|
|
57
|
+
get label() {
|
|
58
|
+
return this.channel.label;
|
|
59
|
+
}
|
|
60
|
+
sendMessage(message) {
|
|
61
|
+
if (this.channel.readyState === 'open') {
|
|
62
|
+
this.channel.send(message);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.oldMessages.push(message);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* This method does **not** filter messages. Use this method only intead of {@link on}
|
|
70
|
+
* if you are sure all messages sent over this channel will contain text.
|
|
71
|
+
*/
|
|
72
|
+
onTextMessage(callback) {
|
|
73
|
+
return this.events.on('message', async (event) => {
|
|
74
|
+
const buffer = await event.data.arrayBuffer();
|
|
75
|
+
const message = new TextDecoder('utf-8').decode(buffer);
|
|
76
|
+
callback(message);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
on = this.events.on.bind(this.events);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class WebRtcConnection {
|
|
83
|
+
iceServers;
|
|
84
|
+
#peerConnection;
|
|
85
|
+
connected = false;
|
|
86
|
+
events = new EventEmitter();
|
|
87
|
+
onIceCandidate;
|
|
88
|
+
onConnectionEstablished;
|
|
89
|
+
constructor(props) {
|
|
90
|
+
this.iceServers = props.iceServers;
|
|
91
|
+
this.onIceCandidate = props.onCandidate;
|
|
92
|
+
this.onConnectionEstablished = props.onConnectionEstablished;
|
|
93
|
+
this.#peerConnection = this.createPeerConnection();
|
|
94
|
+
}
|
|
95
|
+
createPeerConnection() {
|
|
96
|
+
const config = {
|
|
97
|
+
iceServers: this.iceServers ?? [],
|
|
98
|
+
};
|
|
99
|
+
const connection = new RTCPeerConnection(config);
|
|
100
|
+
connection.addEventListener('connectionstatechange', () => {
|
|
101
|
+
if (connection.connectionState === 'disconnected' ||
|
|
102
|
+
connection.connectionState === 'failed' ||
|
|
103
|
+
connection.connectionState === 'closed') {
|
|
104
|
+
this.events.emit('connection_closed', []);
|
|
105
|
+
this.connected = false;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
connection.addEventListener('iceconnectionstatechange', () => {
|
|
109
|
+
if (connection.connectionState === 'connected') {
|
|
110
|
+
this.onConnectionEstablished();
|
|
111
|
+
this.connected = true;
|
|
112
|
+
}
|
|
113
|
+
else if (this.connected) {
|
|
114
|
+
this.events.emit('connection_closed', []);
|
|
115
|
+
this.connected = false;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
connection.onicecandidate = event => {
|
|
119
|
+
if (event.candidate) {
|
|
120
|
+
this.onIceCandidate(event.candidate);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
connection.ondatachannel = event => {
|
|
124
|
+
const channel = new WebRtcDataChannel(event.channel);
|
|
125
|
+
if (channel.label === 'ping-pong') {
|
|
126
|
+
channel.on('message', () => channel.sendMessage('pong'));
|
|
127
|
+
}
|
|
128
|
+
this.events.emit('data_channel', [channel]);
|
|
129
|
+
};
|
|
130
|
+
return connection;
|
|
131
|
+
}
|
|
132
|
+
get peerConnection() {
|
|
133
|
+
return this.#peerConnection;
|
|
134
|
+
}
|
|
135
|
+
createDataChannel(label, options) {
|
|
136
|
+
const channel = this.#peerConnection.createDataChannel(label, options);
|
|
137
|
+
return new WebRtcDataChannel(channel);
|
|
138
|
+
}
|
|
139
|
+
setRemoteDescription(type, sdp) {
|
|
140
|
+
return this.#peerConnection.setRemoteDescription({ type, sdp });
|
|
141
|
+
}
|
|
142
|
+
async createDescription(type) {
|
|
143
|
+
const description = await this.#peerConnection[type === 'offer' ? 'createOffer' : 'createAnswer']();
|
|
144
|
+
await this.#peerConnection.setLocalDescription(description);
|
|
145
|
+
return description;
|
|
146
|
+
}
|
|
147
|
+
addIceCandidate(candidate) {
|
|
148
|
+
return this.#peerConnection.addIceCandidate(new RTCIceCandidate(candidate));
|
|
149
|
+
}
|
|
150
|
+
close() {
|
|
151
|
+
return this.#peerConnection.close();
|
|
152
|
+
}
|
|
153
|
+
on = this.events.on.bind(this.events);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const DEFAULT_SIGNALING_SERVER_URL = 'wss://signal.cloud.luxonis.com/session/';
|
|
157
|
+
class WebRtcClient {
|
|
158
|
+
config;
|
|
159
|
+
socket;
|
|
160
|
+
connection = null;
|
|
161
|
+
signalingConnectionRetries;
|
|
162
|
+
events = new EventEmitter();
|
|
163
|
+
iceCandidates = [];
|
|
164
|
+
constructor(config) {
|
|
165
|
+
this.config = config;
|
|
166
|
+
this.signalingConnectionRetries = (config.signalingConnectionRetries ?? 3) || 0;
|
|
167
|
+
this.connectSignalingServer();
|
|
168
|
+
}
|
|
169
|
+
get signalingServerConnected() {
|
|
170
|
+
return this.socket.readyState === WebSocket.OPEN;
|
|
171
|
+
}
|
|
172
|
+
disconnect(reason) {
|
|
173
|
+
this.connection?.close();
|
|
174
|
+
this.sendMessage({
|
|
175
|
+
Disconnect: {
|
|
176
|
+
type: 'normal',
|
|
177
|
+
reason,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
connect() {
|
|
182
|
+
this.sendMessage({
|
|
183
|
+
ConnectSession: {
|
|
184
|
+
client_id: this.config.clientId,
|
|
185
|
+
application_identifier: this.config.applicationIdentifier,
|
|
186
|
+
auth_payload: this.config.authPayload,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
connectSignalingServer() {
|
|
191
|
+
this.socket = new WebSocket(this.config.signalingServerUrl ?? DEFAULT_SIGNALING_SERVER_URL);
|
|
192
|
+
this.socket.onopen = () => {
|
|
193
|
+
this.connect();
|
|
194
|
+
};
|
|
195
|
+
// this.socket.onclose = () => console.debug('[WebRTC] Disconnected from signaling server');
|
|
196
|
+
this.socket.onerror = error => {
|
|
197
|
+
this.events.emit('error', ['signaling_connection_error', error]);
|
|
198
|
+
if (!this.events.isEventHandled('error')) {
|
|
199
|
+
console.error('[WebRTC] Signaling connection error:', error);
|
|
200
|
+
}
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
if (this.signalingConnectionRetries) {
|
|
203
|
+
this.signalingConnectionRetries -= 1;
|
|
204
|
+
if (this.socket.readyState === WebSocket.CLOSED || this.socket.readyState === WebSocket.CLOSING) {
|
|
205
|
+
// console.debug('[WebRTC] Reconnecting to signaling server');
|
|
206
|
+
this.connectSignalingServer();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}, 3_000);
|
|
210
|
+
};
|
|
211
|
+
this.socket.onmessage = event => {
|
|
212
|
+
const message = JSON.parse(event.data);
|
|
213
|
+
this.handleSignalingMessage(message);
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
disconnectSignalingServer(reason) {
|
|
217
|
+
if (this.signalingServerConnected) {
|
|
218
|
+
this.sendMessage({
|
|
219
|
+
Disconnect: {
|
|
220
|
+
type: 'normal',
|
|
221
|
+
reason,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
this.socket.close();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
handleSignalingMessage(message) {
|
|
228
|
+
if ('AcknowledgeSession' in message) {
|
|
229
|
+
if (message.AcknowledgeSession.acknowledge) {
|
|
230
|
+
this.createConnection();
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
if (!this.events.isEventHandled('error')) {
|
|
234
|
+
console.error('[WebRTC] Connection refused:', message.AcknowledgeSession.reason);
|
|
235
|
+
}
|
|
236
|
+
this.events.emit('error', ['signaling_rejected', message.AcknowledgeSession.reason]);
|
|
237
|
+
this.dispose('Connection refused');
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else if ('Candidate' in message) {
|
|
241
|
+
void this.handleCandidateMessage(message);
|
|
242
|
+
}
|
|
243
|
+
else if ('Disconnect' in message) {
|
|
244
|
+
this.dispose('Targed disconnected');
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async handleCandidateMessage({ Candidate: { type: kind, candidate } }) {
|
|
248
|
+
if (!this.connection) {
|
|
249
|
+
// console.error('[WebRTC] Candidate message dropped: conenction not established');
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
// console.debug('[WebRTC] Processing candidate message', kind);
|
|
253
|
+
switch (kind) {
|
|
254
|
+
case 'answer':
|
|
255
|
+
case 'offer': {
|
|
256
|
+
const data = `${candidate}`;
|
|
257
|
+
if (data === 'null' || data === '') {
|
|
258
|
+
console.error('[WebRTC] Offer refused: remote description cannot be null');
|
|
259
|
+
this.reconnect('Error: received invalid candidate');
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// console.debug('[WebRTC] Offer accepted. Setting remote description..');
|
|
263
|
+
await this.connection.setRemoteDescription(kind, candidate);
|
|
264
|
+
// console.debug('[WebRTC] Set remote description');
|
|
265
|
+
for (const candidate of this.iceCandidates) {
|
|
266
|
+
// console.debug('[WebRTC] Adding stored ICE candidate');
|
|
267
|
+
this.connection.addIceCandidate(JSON.parse(candidate));
|
|
268
|
+
}
|
|
269
|
+
this.iceCandidates = [];
|
|
270
|
+
if (kind === 'offer') {
|
|
271
|
+
const answer = await this.connection.createDescription('answer');
|
|
272
|
+
// console.debug('[WebRTC] Answer created (set local description)');
|
|
273
|
+
this.sendMessage({
|
|
274
|
+
Candidate: {
|
|
275
|
+
type: 'answer',
|
|
276
|
+
candidate: answer.sdp ?? '',
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
case 'candidate': {
|
|
283
|
+
if (this.connection.peerConnection.remoteDescription === null) {
|
|
284
|
+
// console.debug('[WebRTC] Storing ICE candidate (remote description is not set yet)');
|
|
285
|
+
this.iceCandidates.push(candidate);
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
// console.debug('[WebRTC] Adding ICE candidate');
|
|
289
|
+
return this.connection.addIceCandidate(JSON.parse(candidate));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
reconnect(reason) {
|
|
295
|
+
// console.debug(`[WebRTC] Reconnecting: ${reason}`);
|
|
296
|
+
this.disconnect(reason);
|
|
297
|
+
this.connect();
|
|
298
|
+
}
|
|
299
|
+
sendMessage(message) {
|
|
300
|
+
// console.debug('[WebRTC] Sending message', message);
|
|
301
|
+
if (this.socket.readyState === WebSocket.OPEN) {
|
|
302
|
+
this.socket.send(JSON.stringify(message));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
createConnection() {
|
|
306
|
+
this.connection = new WebRtcConnection({
|
|
307
|
+
iceServers: this.config.iceServers,
|
|
308
|
+
onCandidate: candidate => {
|
|
309
|
+
this.sendMessage({
|
|
310
|
+
Candidate: {
|
|
311
|
+
type: 'candidate',
|
|
312
|
+
candidate: JSON.stringify(candidate),
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
onConnectionEstablished: () => this.disconnectSignalingServer('P2P connection established'),
|
|
317
|
+
});
|
|
318
|
+
this.events.emit('connection_established', [this.connection]);
|
|
319
|
+
}
|
|
320
|
+
dispose(reason) {
|
|
321
|
+
this.disconnect(reason);
|
|
322
|
+
this.disconnectSignalingServer(reason);
|
|
323
|
+
}
|
|
324
|
+
on = this.events.on.bind(this.events);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
328
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
329
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
330
|
+
|
|
331
|
+
const MESSAGE_CHANNEL_NAME = "message";
|
|
332
|
+
const SYSTEM_CHANNEL_NAME = "system";
|
|
333
|
+
class WebRtcWorker extends FoxgloveCommunicator {
|
|
334
|
+
#webrtc;
|
|
335
|
+
#messageChannel = null;
|
|
336
|
+
#systemChannel = null;
|
|
337
|
+
#isReady = false;
|
|
338
|
+
#subscriptionId = 0;
|
|
339
|
+
#createWebRtc(config) {
|
|
340
|
+
this.#webrtc = new WebRtcClient(config);
|
|
341
|
+
}
|
|
342
|
+
#handleMessages() {
|
|
343
|
+
this.#webrtc.on("connection_established", connection => {
|
|
344
|
+
connection.on("data_channel", channel => {
|
|
345
|
+
// this.#onOpen(); // TODO:
|
|
346
|
+
|
|
347
|
+
if (channel.label === MESSAGE_CHANNEL_NAME) {
|
|
348
|
+
this.#messageChannel = channel;
|
|
349
|
+
channel.on("message", async ({
|
|
350
|
+
data: {
|
|
351
|
+
subscriptionId,
|
|
352
|
+
data
|
|
353
|
+
}
|
|
354
|
+
}) => {
|
|
355
|
+
this.handleGenericMessage(subscriptionId, data);
|
|
356
|
+
});
|
|
357
|
+
} else if (channel.label === SYSTEM_CHANNEL_NAME) {
|
|
358
|
+
this.#systemChannel = channel;
|
|
359
|
+
channel.on("message", async event => {
|
|
360
|
+
// TODO: Handle service call responses
|
|
361
|
+
const message = JSON.parse(event.data);
|
|
362
|
+
if (message.op === "advertise") {
|
|
363
|
+
this.handleChannelsAdvertisement(message.channels);
|
|
364
|
+
} else if (message.op === 'unadvertise') {
|
|
365
|
+
this.handleChannelsUnadvertisement(message.channelIds);
|
|
366
|
+
} else if (message.op === 'advertiseServices') {
|
|
367
|
+
this.handleServicesAdvertisement(message.services);
|
|
368
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
369
|
+
} else if (message.op === 'unadvertiseServices') {
|
|
370
|
+
this.handleServicesUnadvertisement(message.serviceIds);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
connection.on("connection_closed", () => {
|
|
376
|
+
// this.#onClose(); // TODO:
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
isReady() {
|
|
381
|
+
return this.#isReady;
|
|
382
|
+
}
|
|
383
|
+
sendServiceCallRequest(request) {
|
|
384
|
+
// TODO: Should be binary
|
|
385
|
+
// https://github.com/foxglove/ws-protocol/blob/main/docs/spec.md#service-call-request
|
|
386
|
+
this.#messageChannel?.sendMessage(JSON.stringify(request));
|
|
387
|
+
}
|
|
388
|
+
subscribe(channel) {
|
|
389
|
+
this.#subscriptionId += 1;
|
|
390
|
+
this.#systemChannel?.sendMessage(JSON.stringify({
|
|
391
|
+
op: 'subscribe',
|
|
392
|
+
subscriptions: [{
|
|
393
|
+
id: this.#subscriptionId,
|
|
394
|
+
channelId: channel
|
|
395
|
+
}]
|
|
396
|
+
}));
|
|
397
|
+
return this.#subscriptionId;
|
|
398
|
+
}
|
|
399
|
+
constructor(config, send, sendWithTransfer) {
|
|
400
|
+
super();
|
|
401
|
+
this.send = send;
|
|
402
|
+
this.sendWithTransfer = sendWithTransfer;
|
|
403
|
+
this.#createWebRtc(config);
|
|
404
|
+
this.#handleMessages();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// TODO: binary support
|
|
408
|
+
rawSend(channel, data) {
|
|
409
|
+
if (this.isReady()) {
|
|
410
|
+
const target = channel === 'message' ? this.#messageChannel : this.#systemChannel;
|
|
411
|
+
target?.sendMessage(data);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
close() {
|
|
415
|
+
this.#webrtc.dispose("Connection closed");
|
|
416
|
+
}
|
|
417
|
+
callService({
|
|
418
|
+
name,
|
|
419
|
+
serviceCallId,
|
|
420
|
+
body = {}
|
|
421
|
+
}) {
|
|
422
|
+
super.callService({
|
|
423
|
+
name,
|
|
424
|
+
serviceCallId,
|
|
425
|
+
body
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function createWebRtcWorkerMessageListener(send, sendWithTransfer) {
|
|
430
|
+
let webrtcWorker = null;
|
|
431
|
+
return async event => {
|
|
432
|
+
const {
|
|
433
|
+
type,
|
|
434
|
+
data
|
|
435
|
+
} = event.data;
|
|
436
|
+
switch (type) {
|
|
437
|
+
case "open":
|
|
438
|
+
webrtcWorker = new WebRtcWorker(data.config, send, sendWithTransfer);
|
|
439
|
+
break;
|
|
440
|
+
case "close":
|
|
441
|
+
webrtcWorker?.close();
|
|
442
|
+
break;
|
|
443
|
+
case "send":
|
|
444
|
+
webrtcWorker?.rawSend(data.channel, data.message);
|
|
445
|
+
break;
|
|
446
|
+
case "call_service":
|
|
447
|
+
webrtcWorker?.callService(data);
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export { createWebRtcWorkerMessageListener as c };
|