@formant/realtime-sdk 1.3.0 → 1.3.1

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.
Files changed (217) hide show
  1. package/dist/client/AuthClient.d.ts +42 -0
  2. package/dist/client/Credentials.d.ts +10 -0
  3. package/dist/client/LanAgentClient.d.ts +7 -0
  4. package/dist/client/RtcSignalingClient.d.ts +20 -0
  5. package/dist/common/BaseClient.d.ts +43 -0
  6. package/dist/common/ConnectionError.d.ts +6 -0
  7. package/dist/common/FormantBaseClient.d.ts +13 -0
  8. package/dist/common/LogApiTransport.d.ts +11 -0
  9. package/dist/common/LogClient.d.ts +6 -0
  10. package/dist/common/LogReporter.d.ts +6 -0
  11. package/dist/common/LruCache.d.ts +20 -0
  12. package/dist/common/PromiseLruCache.d.ts +11 -0
  13. package/dist/common/ResponseError.d.ts +11 -0
  14. package/dist/common/ResponseHeadersError.d.ts +7 -0
  15. package/dist/common/StatsManager.d.ts +39 -0
  16. package/dist/common/StatsReporter.d.ts +17 -0
  17. package/dist/common/assertUnreachable.d.ts +1 -0
  18. package/dist/common/browser.d.ts +2 -0
  19. package/dist/common/collectErrors.d.ts +1 -0
  20. package/dist/common/config/index.d.ts +23 -0
  21. package/dist/common/defined.d.ts +6 -0
  22. package/dist/common/delay.d.ts +1 -0
  23. package/dist/common/errorToObject.d.ts +16 -0
  24. package/dist/common/errorToString.d.ts +6 -0
  25. package/dist/common/filterIceServers.d.ts +8 -0
  26. package/dist/common/instanceId.d.ts +1 -0
  27. package/dist/common/isErrorType.d.ts +1 -0
  28. package/dist/common/isObject.d.ts +1 -0
  29. package/dist/common/isValidTagString.d.ts +1 -0
  30. package/dist/common/logger.d.ts +4 -0
  31. package/dist/common/narrowError.d.ts +1 -0
  32. package/dist/common/objectMapValues.d.ts +9 -0
  33. package/dist/common/redact.d.ts +5 -0
  34. package/dist/common/setPromiseInterval.d.ts +16 -0
  35. package/dist/common/stats.d.ts +2 -0
  36. package/dist/common/toStringSafe.d.ts +8 -0
  37. package/dist/date-fns/parseIsoDate.d.ts +1 -0
  38. package/dist/index.js +2 -0
  39. package/dist/index.js.LICENSE.txt +19 -0
  40. package/dist/model/AnnotationAreaType.d.ts +2 -0
  41. package/dist/model/AuditLogActionType.d.ts +5 -0
  42. package/dist/model/CognitoRegion.d.ts +2 -0
  43. package/dist/model/Feature.d.ts +3 -0
  44. package/dist/model/HealthStatus.d.ts +2 -0
  45. package/dist/model/HexRgbColor.d.ts +1 -0
  46. package/dist/model/IAdminSignupRequest.d.ts +14 -0
  47. package/dist/model/IAnnotationAreaTypeMap.d.ts +4 -0
  48. package/dist/model/IAudioChunk.d.ts +5 -0
  49. package/dist/model/IAuditLog.d.ts +14 -0
  50. package/dist/model/IAuthentication.d.ts +8 -0
  51. package/dist/model/IBaseEntity.d.ts +7 -0
  52. package/dist/model/IBattery.d.ts +6 -0
  53. package/dist/model/IBitset.d.ts +4 -0
  54. package/dist/model/IBoundingBox.d.ts +6 -0
  55. package/dist/model/IChallenge.d.ts +7 -0
  56. package/dist/model/ICheckSsoResult.d.ts +5 -0
  57. package/dist/model/IColorRGBA.d.ts +6 -0
  58. package/dist/model/ICompressedImage.d.ts +3 -0
  59. package/dist/model/ICreateServiceAccountResponse.d.ts +5 -0
  60. package/dist/model/IDeviceCredentials.d.ts +9 -0
  61. package/dist/model/IDictionary.d.ts +3 -0
  62. package/dist/model/IFile.d.ts +6 -0
  63. package/dist/model/IFilter.d.ts +11 -0
  64. package/dist/model/IGetFeaturesResponse.d.ts +4 -0
  65. package/dist/model/IGoal.d.ts +5 -0
  66. package/dist/model/IGoalID.d.ts +3 -0
  67. package/dist/model/IGoogleLoginRequest.d.ts +4 -0
  68. package/dist/model/IH264VideoFrame.d.ts +5 -0
  69. package/dist/model/IHealth.d.ts +5 -0
  70. package/dist/model/IImage.d.ts +6 -0
  71. package/dist/model/IImageAnnotation.d.ts +9 -0
  72. package/dist/model/IJointState.d.ts +8 -0
  73. package/dist/model/IJoy.d.ts +4 -0
  74. package/dist/model/IJsonString.d.ts +3 -0
  75. package/dist/model/IListResponse.d.ts +3 -0
  76. package/dist/model/ILocalization.d.ts +14 -0
  77. package/dist/model/ILocation.d.ts +6 -0
  78. package/dist/model/ILogLine.d.ts +9 -0
  79. package/dist/model/ILoginRequest.d.ts +7 -0
  80. package/dist/model/ILoginResult.d.ts +7 -0
  81. package/dist/model/IMap.d.ts +10 -0
  82. package/dist/model/IMarker3D.d.ts +23 -0
  83. package/dist/model/IMarker3DArray.d.ts +4 -0
  84. package/dist/model/IMetric.d.ts +7 -0
  85. package/dist/model/INumericSetEntry.d.ts +5 -0
  86. package/dist/model/IOdometry.d.ts +7 -0
  87. package/dist/model/IPath.d.ts +5 -0
  88. package/dist/model/IPoint.d.ts +2 -0
  89. package/dist/model/IPointCloud.d.ts +6 -0
  90. package/dist/model/IPoseWithCovariance.d.ts +5 -0
  91. package/dist/model/IPostLanRtcOfferRequest.d.ts +3 -0
  92. package/dist/model/IPostLanRtcOfferResponse.d.ts +3 -0
  93. package/dist/model/IQuaternion.d.ts +6 -0
  94. package/dist/model/IRtcAddSignalsRequest.d.ts +4 -0
  95. package/dist/model/IRtcCapabilitySet.d.ts +6 -0
  96. package/dist/model/IRtcCreatePeerRequest.d.ts +6 -0
  97. package/dist/model/IRtcCreateSessionRequest.d.ts +5 -0
  98. package/dist/model/IRtcIceServer.d.ts +5 -0
  99. package/dist/model/IRtcInfo.d.ts +7 -0
  100. package/dist/model/IRtcPeer.d.ts +11 -0
  101. package/dist/model/IRtcPeerDescription.d.ts +6 -0
  102. package/dist/model/IRtcPortForwardingConfiguration.d.ts +3 -0
  103. package/dist/model/IRtcSession.d.ts +12 -0
  104. package/dist/model/IRtcSignal.d.ts +3 -0
  105. package/dist/model/IRtcStream.d.ts +9 -0
  106. package/dist/model/IRtcStreamCapability.d.ts +6 -0
  107. package/dist/model/IRtcStreamingConfiguration.d.ts +4 -0
  108. package/dist/model/IScopeFilter.d.ts +6 -0
  109. package/dist/model/IStat.d.ts +21 -0
  110. package/dist/model/IStreamTypeMap.d.ts +27 -0
  111. package/dist/model/ITagFilter.d.ts +4 -0
  112. package/dist/model/ITagSets.d.ts +3 -0
  113. package/dist/model/ITaggedEntity.d.ts +5 -0
  114. package/dist/model/ITags.d.ts +2 -0
  115. package/dist/model/ITransform.d.ts +6 -0
  116. package/dist/model/ITransformNode.d.ts +8 -0
  117. package/dist/model/ITwist.d.ts +5 -0
  118. package/dist/model/IUser.d.ts +36 -0
  119. package/dist/model/IUserScope.d.ts +16 -0
  120. package/dist/model/IValidation.d.ts +3 -0
  121. package/dist/model/IVector3.d.ts +5 -0
  122. package/dist/model/IVideo.d.ts +7 -0
  123. package/dist/model/IsoDate.d.ts +1 -0
  124. package/dist/model/LanguageType.d.ts +2 -0
  125. package/dist/model/LogLevel.d.ts +2 -0
  126. package/dist/model/Marker3DAction.d.ts +2 -0
  127. package/dist/model/Marker3DType.d.ts +2 -0
  128. package/dist/model/OrganizationPlan.d.ts +2 -0
  129. package/dist/model/RequireKeys.d.ts +3 -0
  130. package/dist/model/RtcConnectionStatus.d.ts +2 -0
  131. package/dist/model/RtcIceServerProtocol.d.ts +2 -0
  132. package/dist/model/RtcIceTransportPolicy.d.ts +2 -0
  133. package/dist/model/RtcSessionType.d.ts +2 -0
  134. package/dist/model/RtcStreamType.d.ts +3 -0
  135. package/dist/model/SmsOptInStatus.d.ts +2 -0
  136. package/dist/model/StreamType.d.ts +2 -0
  137. package/dist/model/Timeout.d.ts +1 -0
  138. package/dist/model/Timestamp.d.ts +1 -0
  139. package/dist/model/Uuid.d.ts +1 -0
  140. package/dist/model/VideoMimeType.d.ts +2 -0
  141. package/dist/model/auditLogActionTypes.d.ts +1 -0
  142. package/dist/model/bytes.d.ts +9 -0
  143. package/dist/model/cognitoRegions.d.ts +1 -0
  144. package/dist/model/duration.d.ts +10 -0
  145. package/dist/model/features.d.ts +2 -0
  146. package/dist/model/healthStatuses.d.ts +5 -0
  147. package/dist/model/languageTypes.d.ts +1 -0
  148. package/dist/model/logLevels.d.ts +1 -0
  149. package/dist/model/marker3DActions.d.ts +1 -0
  150. package/dist/model/marker3DTypes.d.ts +1 -0
  151. package/dist/model/organizationPlans.d.ts +1 -0
  152. package/dist/model/rtcConnectionStatuses.d.ts +1 -0
  153. package/dist/model/rtcIceServerProtocols.d.ts +1 -0
  154. package/dist/model/rtcIceTransportPolicies.d.ts +1 -0
  155. package/dist/model/rtcSessionTypes.d.ts +1 -0
  156. package/dist/model/rtcStreamTypes.d.ts +28 -0
  157. package/dist/model/smsOptInStatuses.d.ts +1 -0
  158. package/dist/model/videoMimeTypes.d.ts +1 -0
  159. package/dist/protos/api/signaling/v1/signaling.proto +114 -0
  160. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.d.ts +125 -0
  161. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.js +626 -0
  162. package/dist/protos/api/signaling/v1/signaling_pb.d.ts +458 -0
  163. package/dist/protos/api/signaling/v1/signaling_pb.js +3854 -0
  164. package/dist/realtime-sdk/src/config/index.d.ts +2 -0
  165. package/dist/realtime-sdk/src/index.d.ts +18 -0
  166. package/dist/rtc-client/DeadlineEnforcer.d.ts +4 -0
  167. package/dist/rtc-client/DeadlineReachedError.d.ts +3 -0
  168. package/dist/rtc-client/IHasPeerConnection.d.ts +3 -0
  169. package/dist/rtc-client/IHasRemoteDeviceId.d.ts +4 -0
  170. package/dist/rtc-client/RtcClient.d.ts +71 -0
  171. package/dist/rtc-client/RtcClientV1.d.ts +52 -0
  172. package/dist/rtc-client/RtcConnection.d.ts +95 -0
  173. package/dist/rtc-client/RtcConnectionV1.d.ts +73 -0
  174. package/dist/rtc-client/RtcSessionMetrics.d.ts +17 -0
  175. package/dist/rtc-client/RtcSessionMetricsV1.d.ts +14 -0
  176. package/dist/rtc-client/config/index.d.ts +11 -0
  177. package/dist/rtc-client/gatherPingMetrics.d.ts +17 -0
  178. package/dist/rtc-client/models/IIceMode.d.ts +1 -0
  179. package/dist/rtc-client/models/IPingInfo.d.ts +10 -0
  180. package/dist/rtc-client/models/IPingPayload.d.ts +6 -0
  181. package/dist/rtc-client/models/IRTCStatsIceCandidate.d.ts +9 -0
  182. package/dist/rtc-client/models/IRTCStatsIceCandidatePair.d.ts +9 -0
  183. package/dist/rtc-client/models/IRTCStatsTransport.d.ts +8 -0
  184. package/dist/rtc-client/models/IRtcAgentInfo.d.ts +3 -0
  185. package/dist/rtc-client/models/IRtcClientConfiguration.d.ts +18 -0
  186. package/dist/rtc-client/models/IRtcConnectionBaseConfiguration.d.ts +16 -0
  187. package/dist/rtc-client/models/IRtcConnectionConfiguration.d.ts +6 -0
  188. package/dist/rtc-client/models/IRtcConnectionRemoteConfiguration.d.ts +6 -0
  189. package/dist/rtc-client/models/IRtcConnectionStatsInfo.d.ts +9 -0
  190. package/dist/rtc-client/models/IRtcPointCloud.d.ts +5 -0
  191. package/dist/rtc-client/models/IRtcSendConfiguration.d.ts +4 -0
  192. package/dist/rtc-client/models/IRtcSessionMetricsMessageCounts.d.ts +6 -0
  193. package/dist/rtc-client/models/IRtcStreamCommunication.d.ts +4 -0
  194. package/dist/rtc-client/models/IRtcStreamMessage.d.ts +7 -0
  195. package/dist/rtc-client/models/IRtcStreamMessageChunk.d.ts +7 -0
  196. package/dist/rtc-client/models/IRtcStreamMessageHeader.d.ts +7 -0
  197. package/dist/rtc-client/models/IRtcStreamPayload.d.ts +55 -0
  198. package/dist/rtc-client/models/IRtcStreamsInfo.d.ts +9 -0
  199. package/dist/rtc-client/models/IStreamControl.d.ts +23 -0
  200. package/dist/rtc-client/models/RtcChannelLabel.d.ts +2 -0
  201. package/dist/rtc-client/models/RtcCommunicationType.d.ts +1 -0
  202. package/dist/rtc-client/models/rtcChannelLabels.d.ts +1 -0
  203. package/dist/rtc-client/models-v1/IRtcClientConfigurationV1.d.ts +11 -0
  204. package/dist/rtc-client/models-v1/IRtcConnectionConfigurationV1.d.ts +12 -0
  205. package/dist/rtc-client/utils/assertHasPeerConnection.d.ts +1 -0
  206. package/dist/rtc-client/utils/createRtcStreamMessage.d.ts +4 -0
  207. package/dist/rtc-client/utils/encodeStreamId.d.ts +3 -0
  208. package/dist/rtc-client/utils/garbageCollect.d.ts +1 -0
  209. package/dist/rtc-client/utils/getErrorMessage.d.ts +1 -0
  210. package/dist/rtc-client/utils/iceModeFromRtcConnectionInfo.d.ts +3 -0
  211. package/dist/rtc-client/utils/isInactive.d.ts +1 -0
  212. package/dist/rtc-client/utils/partition.d.ts +1 -0
  213. package/dist/rtc-client/utils/peerToRtcPeer.d.ts +3 -0
  214. package/dist/rtc-client/utils/reassembleMessageChunks.d.ts +3 -0
  215. package/dist/rtc-client/utils/reifyZeroValues.d.ts +2 -0
  216. package/dist/rtc-client/utils/streamIsEqual.d.ts +2 -0
  217. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export declare const namespace: string;
2
+ export declare const app: string;
@@ -0,0 +1,18 @@
1
+ export { AuthClient } from "../../client/AuthClient";
2
+ export { RtcSignalingClient } from "../../client/RtcSignalingClient";
3
+ export { Credentials } from "../../client/Credentials";
4
+ export { SignalingPromiseClient } from "../../protos/api/signaling/v1/signaling_grpc_web_pb";
5
+ export { RtcClient } from "../../rtc-client/RtcClient";
6
+ export { RtcClientV1 } from "../../rtc-client/RtcClientV1";
7
+ export { createRtcStreamMessage } from "../../rtc-client/utils/createRtcStreamMessage";
8
+ export type { IRtcStream } from "../../model/IRtcStream";
9
+ export type { IRtcPeer } from "../../model/IRtcPeer";
10
+ export type { RtcStreamType } from "../../model/RtcStreamType";
11
+ export type { IRtcClientConfigurationV1 } from "../../rtc-client/models-v1/IRtcClientConfigurationV1";
12
+ export type { IRtcClientConfiguration } from "../../rtc-client/models/IRtcClientConfiguration";
13
+ export type { IRtcConnectionStatsInfo } from "../../rtc-client/models/IRtcConnectionStatsInfo";
14
+ export type { IRtcSendConfiguration } from "../../rtc-client/models/IRtcSendConfiguration";
15
+ export type { IRtcSessionMetricsMessageCounts } from "../../rtc-client/models/IRtcSessionMetricsMessageCounts";
16
+ export type { IRtcStreamMessage } from "../../rtc-client/models/IRtcStreamMessage";
17
+ export type { IRtcStreamPayload } from "../../rtc-client/models/IRtcStreamPayload";
18
+ export type { IStreamControl } from "../../rtc-client/models/IStreamControl";
@@ -0,0 +1,4 @@
1
+ export declare class DeadlineEnforcer {
2
+ private static readonly grpcCallDeadlineSlopMs;
3
+ static withDeadline<T>(request: Promise<T>, deadlineMs: number): Promise<T>;
4
+ }
@@ -0,0 +1,3 @@
1
+ export declare class DeadlineReachedError extends Error {
2
+ constructor(deadlineMs: number, slopMs: number);
3
+ }
@@ -0,0 +1,3 @@
1
+ export interface IHasPeerConnection {
2
+ peerConnection: RTCPeerConnection;
3
+ }
@@ -0,0 +1,4 @@
1
+ import { Uuid } from "../model/Uuid";
2
+ export interface IHasRemoteDeviceId {
3
+ getRemoteDeviceId(): Uuid | undefined;
4
+ }
@@ -0,0 +1,71 @@
1
+ import { IRtcInfo } from "../model/IRtcInfo";
2
+ import { IRtcPeer } from "../model/IRtcPeer";
3
+ import { RtcConnectionStatus } from "../model/RtcConnectionStatus";
4
+ import { Timestamp } from "../model/Timestamp";
5
+ import { Uuid } from "../model/Uuid";
6
+ import { IPingInfo } from "./models/IPingInfo";
7
+ import { IRtcClientConfiguration } from "./models/IRtcClientConfiguration";
8
+ import { IRtcConnectionStatsInfo } from "./models/IRtcConnectionStatsInfo";
9
+ import { IRtcSendConfiguration } from "./models/IRtcSendConfiguration";
10
+ import { IRtcSessionMetricsMessageCounts } from "./models/IRtcSessionMetricsMessageCounts";
11
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
12
+ import { IStreamControl } from "./models/IStreamControl";
13
+ import { RtcConnection } from "./RtcConnection";
14
+ /**
15
+ * RtcClient to be used by browsers.
16
+ */
17
+ export declare class RtcClient {
18
+ private config;
19
+ private readonly grpcCallDeadline;
20
+ private readonly refreshIntervalDelayMs;
21
+ private readonly iceServersTtl;
22
+ private localPeer?;
23
+ private iceServers?;
24
+ private iceServersLastUpdate?;
25
+ private receiveSignalStream?;
26
+ private refreshInterval;
27
+ private connections;
28
+ private localConnections;
29
+ private isConnectionInitiator;
30
+ private isOutgoingConnection;
31
+ private peerDataChannelListeners;
32
+ private rtcInstancesConstructed;
33
+ private statsLoopsExecuted;
34
+ constructor(config: IRtcClientConfiguration);
35
+ send(remotePeerId: Uuid, message: IRtcStreamMessage, config: IRtcSendConfiguration): void;
36
+ controlRemoteStream(remotePeerId: Uuid, streamControl: IStreamControl): void;
37
+ getLocalPeer(): Promise<IRtcPeer>;
38
+ /**
39
+ * Connects to a peer given its id.
40
+ * Returns the id of the session, if one is created.
41
+ */
42
+ connect(remotePeerId: Uuid, rtcInfo?: IRtcInfo): Promise<Uuid | undefined>;
43
+ connectLan(agentEndpoint: string): Promise<Uuid | false>;
44
+ getConnections(): RtcConnection[];
45
+ createCustomDataChannel(remotePeerId: Uuid, channelName: string, init: RTCDataChannelInit, isBinary: boolean, listener: (peerId: Uuid, channel: RTCDataChannel) => void): () => void;
46
+ private onCustomDataChannel;
47
+ getConnectionStatus(remotePeerId: Uuid): RtcConnectionStatus;
48
+ getConnectionStatsInfo(remotePeerId: Uuid): Promise<IRtcConnectionStatsInfo | undefined>;
49
+ disconnect(remotePeerId: Uuid): Promise<void>;
50
+ getPeers(): Promise<IRtcPeer[]>;
51
+ getSessions(): Promise<{
52
+ [key in string]: string[];
53
+ }>;
54
+ getPing(remotePeerId: Uuid): number | undefined;
55
+ getPingInfo(remotePeerId: Uuid): IPingInfo | undefined;
56
+ getLastMessageTimestamp(remotePeerId: Uuid): Timestamp | undefined;
57
+ getSessionMetricsMessageCounts(remotePeerId: Uuid): IRtcSessionMetricsMessageCounts | undefined;
58
+ isReady(): boolean;
59
+ shutdown(): Promise<void>;
60
+ private createPeer;
61
+ private createReceiveSignalStream;
62
+ private createRTCPeerConnection;
63
+ private closeConnections;
64
+ private getActiveConnection;
65
+ private update;
66
+ private gatherConnectionStats;
67
+ private reset;
68
+ private updateIceServers;
69
+ private setupHandlers;
70
+ private getMetadata;
71
+ }
@@ -0,0 +1,52 @@
1
+ import { IRtcPeer } from "../model/IRtcPeer";
2
+ import { RtcConnectionStatus } from "../model/RtcConnectionStatus";
3
+ import { Timestamp } from "../model/Timestamp";
4
+ import { Uuid } from "../model/Uuid";
5
+ import { IRtcClientConfigurationV1 } from "./models-v1/IRtcClientConfigurationV1";
6
+ import { IIceMode } from "./models/IIceMode";
7
+ import { IRtcSendConfiguration } from "./models/IRtcSendConfiguration";
8
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
9
+ import { IStreamControl } from "./models/IStreamControl";
10
+ /**
11
+ * RtcClient to be used by browsers.
12
+ * Interacts with signaling API v1.
13
+ */
14
+ export declare class RtcClientV1 {
15
+ private config;
16
+ private localPeer;
17
+ private updateInterval;
18
+ private connections;
19
+ private connectingSessions;
20
+ private rtcInstancesConstructed;
21
+ constructor(config: IRtcClientConfigurationV1);
22
+ send(peerId: Uuid, message: IRtcStreamMessage, config: IRtcSendConfiguration): void;
23
+ controlRemoteStream(peerId: Uuid, streamControl: IStreamControl): void;
24
+ /**
25
+ * Connects to a peer given its id.
26
+ * Returns the id of the session, if one is created.
27
+ */
28
+ connect(peerId: Uuid): Promise<Uuid | undefined>;
29
+ getConnectionStatus(peerId: Uuid): RtcConnectionStatus;
30
+ getIceMode(peerId: Uuid): IIceMode | undefined;
31
+ disconnect(peerId: Uuid): Promise<void>;
32
+ getLocalPeer(): Promise<IRtcPeer>;
33
+ getPeers(): Promise<IRtcPeer[]>;
34
+ getPing(peerId: Uuid): number | undefined;
35
+ getLastMessageTimestamp(remotePeerId: Uuid): Timestamp | undefined;
36
+ shutdown(): Promise<void>;
37
+ private closeConnection;
38
+ private getSessions;
39
+ private createPeer;
40
+ private createRTCPeerConnection;
41
+ private closeConnections;
42
+ private reset;
43
+ private getActiveConnection;
44
+ private update;
45
+ private handleSessions;
46
+ private syncConnectionsAndSessions;
47
+ private maintainConnection;
48
+ private connectToSession;
49
+ private setupHandlers;
50
+ private consumeSignals;
51
+ private sendSignal;
52
+ }
@@ -0,0 +1,95 @@
1
+ import { Timestamp } from "../model/Timestamp";
2
+ import { Uuid } from "../model/Uuid";
3
+ import { Signal } from "../protos/api/signaling/v1/signaling_pb";
4
+ import { IHasPeerConnection } from "./IHasPeerConnection";
5
+ import { IHasRemoteDeviceId } from "./IHasRemoteDeviceId";
6
+ import { IPingInfo } from "./models/IPingInfo";
7
+ import { IRtcConnectionConfiguration } from "./models/IRtcConnectionConfiguration";
8
+ import { IRtcConnectionStatsInfo } from "./models/IRtcConnectionStatsInfo";
9
+ import { IRtcSendConfiguration } from "./models/IRtcSendConfiguration";
10
+ import { IRtcSessionMetricsMessageCounts } from "./models/IRtcSessionMetricsMessageCounts";
11
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
12
+ import { IStreamControl } from "./models/IStreamControl";
13
+ export declare class RtcConnection implements IHasPeerConnection, IHasRemoteDeviceId {
14
+ private iceServers;
15
+ private config;
16
+ private dataChannelNotifier;
17
+ private readonly connectTimeoutMs;
18
+ private readonly iceGatheringTimeoutMs;
19
+ private readonly pingUpdateTimeoutMs;
20
+ private readonly pingV2UpdateTimeoutMs;
21
+ private readonly pingV2MetricsGatherTimeoutMs;
22
+ private readonly streamsInfoUpdateTimeoutMs;
23
+ private readonly reassemblyTimeoutMs;
24
+ private readonly reassemblyTableCleanupMs;
25
+ private readonly heartbeatTimeoutMs;
26
+ private _peerConnection;
27
+ get peerConnection(): RTCPeerConnection;
28
+ private heartbeatChannel;
29
+ private latestTtlStreamChannel;
30
+ private reliableStreamChannel;
31
+ private latestReliableStreamChannel;
32
+ private latestTryOnceStreamChannel;
33
+ private streamLatestTimestamp;
34
+ private reassemblyTable;
35
+ private reassemblyTableLastTimestamp;
36
+ private pingTimeMs;
37
+ private lastMessageTimestamp;
38
+ private sessionMetrics;
39
+ private closeCalled;
40
+ private gotOffer;
41
+ private hasIceCandidate;
42
+ private pingV2Map;
43
+ private pingInfo;
44
+ private readonly reassemblyTableCleanupTimeout;
45
+ private readonly pingUpdateTimeout;
46
+ private readonly pingV2UpdateTimeout;
47
+ private readonly pingV2MetricsGatherTimeout;
48
+ private readonly streamsInfoUpdateTimeout;
49
+ private readonly heartbeatTimeout;
50
+ constructor(peerConnection: RTCPeerConnection, iceServers: RTCIceServer[], config: IRtcConnectionConfiguration, dataChannelNotifier: (channel: RTCDataChannel) => void);
51
+ handleSignal(signal: Signal): Promise<Signal | undefined>;
52
+ /**
53
+ * Sends a message to the remote peer.
54
+ */
55
+ send(message: IRtcStreamMessage, config: IRtcSendConfiguration): void;
56
+ controlRemoteStream(streamControl: IStreamControl): void;
57
+ isActive(): boolean;
58
+ /**
59
+ * Checks that the peerConnection is connected
60
+ * and all data channels exist and are open
61
+ */
62
+ isReady(): boolean;
63
+ close(): Promise<void>;
64
+ getPing(): number | undefined;
65
+ getPingInfo(): IPingInfo | undefined;
66
+ getLastMessageTimestamp(): Timestamp | undefined;
67
+ getSessionCreatedTimestamp(): Timestamp | undefined;
68
+ setSessionCreatedTimestamp(sessionCreatedTimestamp: Timestamp): void;
69
+ getSessionId(): Uuid | undefined;
70
+ setSessionId(sessionId: Uuid): void;
71
+ getRemotePeerId(): Uuid | undefined;
72
+ getRemoteDeviceId(): Uuid | undefined;
73
+ setRemoteDeviceId(deviceId: Uuid | undefined): void;
74
+ getSessionMetricsMessageCounts(): IRtcSessionMetricsMessageCounts | undefined;
75
+ getConnectionStatsInfo(): Promise<IRtcConnectionStatsInfo | undefined>;
76
+ private initializeChannels;
77
+ getOffer(): Promise<Signal | undefined>;
78
+ getLanOffer(): Promise<RTCSessionDescription | undefined>;
79
+ handleLanAnswer(answerSdp: RTCSessionDescription): Promise<void>;
80
+ private getChannelFromLabel;
81
+ private sendOnChannel;
82
+ private channelNotRecognized;
83
+ private setupChannel;
84
+ private receiveChannelMessage;
85
+ private receiveChannelMessageChunk;
86
+ /**
87
+ * Handles system messages (e.g., ping/pong).
88
+ * Returns true if the message is a system message.
89
+ */
90
+ private handleSystemMessage;
91
+ private sendSystemMessage;
92
+ private isLatestMessage;
93
+ private sendPingV2;
94
+ private gatherPingV2Metrics;
95
+ }
@@ -0,0 +1,73 @@
1
+ import { IRtcSignal } from "../model/IRtcSignal";
2
+ import { IHasPeerConnection } from "./IHasPeerConnection";
3
+ import { IRtcConnectionConfigurationV1 } from "./models-v1/IRtcConnectionConfigurationV1";
4
+ import { IIceMode } from "./models/IIceMode";
5
+ import { IRtcSendConfiguration } from "./models/IRtcSendConfiguration";
6
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
7
+ import { IStreamControl } from "./models/IStreamControl";
8
+ export declare class RtcConnectionV1 implements IHasPeerConnection {
9
+ peerConnection: RTCPeerConnection;
10
+ private config;
11
+ iceMode?: IIceMode;
12
+ private readonly connectTimeoutMs;
13
+ private readonly gatherIceTimeoutMs;
14
+ private readonly pingUpdateTimeoutMs;
15
+ private latestTtlStreamChannel?;
16
+ private reliableStreamChannel?;
17
+ private latestReliableStreamChannel?;
18
+ private latestTryOnceStreamChannel?;
19
+ private streamLatestTimestamp;
20
+ private pingUpdateTimeout;
21
+ private pingTimeMs;
22
+ private lastMessageTimestamp;
23
+ private connectTimeout;
24
+ private gatherIceTimeout;
25
+ private sessionMetrics;
26
+ private closeCalled;
27
+ private connectCalled;
28
+ private sentOffer;
29
+ private receivedIceCandidate;
30
+ constructor(peerConnection: RTCPeerConnection, config: IRtcConnectionConfigurationV1);
31
+ connect(): Promise<void>;
32
+ handleSignal(signal: IRtcSignal): Promise<void>;
33
+ /**
34
+ * Sends a message to the remote peer.
35
+ */
36
+ send(message: IRtcStreamMessage, config: IRtcSendConfiguration): void;
37
+ controlRemoteStream(streamControl: IStreamControl): void;
38
+ isActive(): boolean;
39
+ /**
40
+ * Checks that the peerConnection is connected
41
+ * and all data channels exist and are open
42
+ */
43
+ isReady(): boolean;
44
+ /**
45
+ * Checks that the peerConnection is closed and all
46
+ * existing data channels are closed
47
+ */
48
+ isClosed(): boolean;
49
+ /**
50
+ * Checks that either the peerConnection is inactive
51
+ * or at least one of the the data channels exists and is inactive
52
+ */
53
+ needsClosing(): boolean | undefined;
54
+ close(): Promise<void>;
55
+ getPing(): number | undefined;
56
+ getLastMessageTimestamp(): number | undefined;
57
+ getSessionId(): string;
58
+ getRemotePeer(): import("src").IRtcPeer;
59
+ private initializeChannels;
60
+ private sendOffer;
61
+ private getChannelFromLabel;
62
+ private sendOnChannel;
63
+ private channelNotRecognized;
64
+ private setupChannel;
65
+ /**
66
+ * Handles system messages (e.g., ping/pong).
67
+ * Returns true if the message is a system message.
68
+ */
69
+ private handleSystemMessage;
70
+ private sendSystemMessage;
71
+ private hasCapabilities;
72
+ private isLatestMessage;
73
+ }
@@ -0,0 +1,17 @@
1
+ import { Timestamp } from "../model/Timestamp";
2
+ import { IHasPeerConnection } from "./IHasPeerConnection";
3
+ import { IHasRemoteDeviceId } from "./IHasRemoteDeviceId";
4
+ import { IRtcSessionMetricsMessageCounts } from "./models/IRtcSessionMetricsMessageCounts";
5
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
6
+ import { IRtcStreamsInfo } from "./models/IRtcStreamsInfo";
7
+ export declare class RtcSessionMetrics {
8
+ counts: IRtcSessionMetricsMessageCounts;
9
+ private readonly sessionId;
10
+ private readonly connection;
11
+ constructor(sessionId: string, connection: IHasPeerConnection & IHasRemoteDeviceId);
12
+ updateRemoteMessagesCounts(message: IRtcStreamMessage): void;
13
+ getLocalStreamsInfo(timestamp: Timestamp): IRtcStreamsInfo;
14
+ incrementLocalSent(message: IRtcStreamMessage): void;
15
+ incrementLocalReceived(message: IRtcStreamMessage): void;
16
+ uploadMetrics(): Promise<void>;
17
+ }
@@ -0,0 +1,14 @@
1
+ import { IHasPeerConnection } from "./IHasPeerConnection";
2
+ import { IRtcStreamMessage } from "./models/IRtcStreamMessage";
3
+ type IRtcConnectionV1 = IHasPeerConnection;
4
+ export declare class RtcSessionMetricsV1 {
5
+ private readonly sentMessagesCounts;
6
+ private readonly receivedMessagesCounts;
7
+ private readonly sessionId;
8
+ private readonly connection;
9
+ constructor(sessionId: string, connection: IRtcConnectionV1);
10
+ incrementMessageSent(message: IRtcStreamMessage): void;
11
+ incrementMessageReceived(message: IRtcStreamMessage): void;
12
+ uploadMetrics(): Promise<void>;
13
+ }
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import { RtcChannelLabel } from "../models/RtcChannelLabel";
2
+ export declare const latesTtlStreamLabel: RtcChannelLabel;
3
+ export declare const latestTtlStreamConfig: RTCDataChannelInit;
4
+ export declare const reliableStreamLabel: RtcChannelLabel;
5
+ export declare const reliableStreamConfig: RTCDataChannelInit;
6
+ export declare const latestReliableStreamLabel: RtcChannelLabel;
7
+ export declare const latestReliableStreamConfig: RTCDataChannelInit;
8
+ export declare const latestTryOnceStreamLabel: RtcChannelLabel;
9
+ export declare const latestTryOnceStreamConfig: RTCDataChannelInit;
10
+ export declare const heartbeatChannelLabel: RtcChannelLabel;
11
+ export declare const heartbeatChannelConfig: RTCDataChannelInit;
@@ -0,0 +1,17 @@
1
+ import { Timestamp } from "../model/Timestamp";
2
+ import { Uuid } from "../model/Uuid";
3
+ import { IPingInfo } from "./models/IPingInfo";
4
+ export interface IPing {
5
+ sent: Timestamp;
6
+ }
7
+ export interface IPingPong {
8
+ sent: Timestamp;
9
+ received: Timestamp;
10
+ }
11
+ export type PingValue = IPing | IPingPong;
12
+ export type PingMap = Map<Uuid, PingValue>;
13
+ interface IGatherPingV2MetricsOptions {
14
+ temporalNow?: number;
15
+ }
16
+ export declare function gatherPingV2Metrics(pingMap: PingMap, options?: IGatherPingV2MetricsOptions): IPingInfo | null;
17
+ export {};
@@ -0,0 +1 @@
1
+ export type IIceMode = "local" | "STUN" | "TURN";
@@ -0,0 +1,10 @@
1
+ export interface IPingInfo {
2
+ pingsSent: number;
3
+ pongsReceived: number;
4
+ average: number;
5
+ standardDeviation: number;
6
+ jitter: number;
7
+ min: number;
8
+ max: number;
9
+ loss: number;
10
+ }
@@ -0,0 +1,6 @@
1
+ import { Timestamp } from "../../model/Timestamp";
2
+ import { Uuid } from "../../model/Uuid";
3
+ export interface IPingPayload {
4
+ timestamp: Timestamp;
5
+ id: Uuid;
6
+ }
@@ -0,0 +1,9 @@
1
+ export interface IRTCStatsIceCandidate {
2
+ type: "local-candidate" | "remote-candidate";
3
+ candidateType: "host" | "srflx" | "prflx" | "relay";
4
+ transportId: string;
5
+ address: string;
6
+ port: number;
7
+ protocol: "udp" | "tcp";
8
+ relayProtocol?: "udp" | "tcp";
9
+ }
@@ -0,0 +1,9 @@
1
+ export interface IRTCStatsIceCandidatePair {
2
+ id: "candidatepair";
3
+ transportId: string;
4
+ localCandidateId: string;
5
+ remoteCandidateId: string;
6
+ nominated: boolean;
7
+ bytesReceived: number;
8
+ bytesSent: number;
9
+ }
@@ -0,0 +1,8 @@
1
+ export interface IRTCStatsTransport {
2
+ id: "transport";
3
+ selectedCandidatePairId: string;
4
+ bytesSent: number;
5
+ bytesReceived: number;
6
+ packetsSent: number;
7
+ packetsReceived: number;
8
+ }
@@ -0,0 +1,3 @@
1
+ export interface IRtcAgentInfo {
2
+ isLowBandwidthMode?: boolean;
3
+ }
@@ -0,0 +1,18 @@
1
+ import { Timestamp } from "../../model/Timestamp";
2
+ import { Uuid } from "../../model/Uuid";
3
+ import { SignalingPromiseClient } from "../../protos/api/signaling/v1/signaling_grpc_web_pb";
4
+ import { SessionType } from "../../protos/api/signaling/v1/signaling_pb";
5
+ import { IRtcStreamMessage } from "./IRtcStreamMessage";
6
+ export type IRtcClientConfiguration = {
7
+ receive: (peerId: Uuid, message: IRtcStreamMessage) => void;
8
+ onStreamsInfoUpdate?: (peerId: Uuid, timestamp: Timestamp) => void;
9
+ alternateRTCPeerConnection?: typeof RTCPeerConnection;
10
+ sessionType?: SessionType;
11
+ } & ({
12
+ lanOnlyMode: true;
13
+ } | {
14
+ lanOnlyMode?: false;
15
+ getToken: () => Promise<string>;
16
+ signalingClient: SignalingPromiseClient;
17
+ track?: (event: string, properties?: object) => void;
18
+ });
@@ -0,0 +1,16 @@
1
+ import { Timestamp } from "../../model/Timestamp";
2
+ import { Uuid } from "../../model/Uuid";
3
+ import { SessionType } from "../../protos/api/signaling/v1/signaling_pb";
4
+ import { IRtcStreamMessage } from "./IRtcStreamMessage";
5
+ export interface IRtcConnectionBaseConfiguration {
6
+ isOffer: boolean;
7
+ isLan: boolean;
8
+ localPeerId: Uuid;
9
+ remotePeerId: Uuid;
10
+ localUserId?: Uuid;
11
+ remoteDeviceId?: Uuid;
12
+ sessionType?: SessionType;
13
+ receive: (peerId: Uuid, message: IRtcStreamMessage) => void;
14
+ onStreamsInfoUpdate?: (peerId: Uuid, timestamp: Timestamp) => void;
15
+ track?: (event: string, properties?: object) => void;
16
+ }
@@ -0,0 +1,6 @@
1
+ import { IRtcConnectionBaseConfiguration } from "./IRtcConnectionBaseConfiguration";
2
+ import { IRtcConnectionRemoteConfiguration } from "./IRtcConnectionRemoteConfiguration";
3
+ export type IRtcConnectionConfiguration = {
4
+ baseConfig: IRtcConnectionBaseConfiguration;
5
+ remoteConfig?: IRtcConnectionRemoteConfiguration;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { Timestamp } from "../../model/Timestamp";
2
+ import { Uuid } from "../../model/Uuid";
3
+ export interface IRtcConnectionRemoteConfiguration {
4
+ sessionId?: Uuid;
5
+ sessionCreatedTimestamp?: Timestamp;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { IRTCStatsIceCandidate } from "./IRTCStatsIceCandidate";
2
+ import { IRTCStatsIceCandidatePair } from "./IRTCStatsIceCandidatePair";
3
+ import { IRTCStatsTransport } from "./IRTCStatsTransport";
4
+ export interface IRtcConnectionStatsInfo {
5
+ transport: IRTCStatsTransport;
6
+ localCandidate: IRTCStatsIceCandidate;
7
+ remoteCandidate: IRTCStatsIceCandidate;
8
+ candidatePair: IRTCStatsIceCandidatePair;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { ITransform } from "../../model/ITransform";
2
+ export interface IRtcPointCloud {
3
+ world_to_local?: ITransform;
4
+ data: string;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { RtcChannelLabel } from "./RtcChannelLabel";
2
+ export interface IRtcSendConfiguration {
3
+ channelLabel: RtcChannelLabel;
4
+ }
@@ -0,0 +1,6 @@
1
+ export interface IRtcSessionMetricsMessageCounts {
2
+ localSent: Map<string, number>;
3
+ localReceived: Map<string, number>;
4
+ remoteSent: Map<string, number>;
5
+ remoteReceived: Map<string, number>;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { RtcCommunicationType } from "./RtcCommunicationType";
2
+ export interface IRtcStreamCommunication<T = RtcCommunicationType> {
3
+ communicationType?: T;
4
+ }
@@ -0,0 +1,7 @@
1
+ import { IRtcStreamCommunication } from "./IRtcStreamCommunication";
2
+ import { IRtcStreamMessageHeader } from "./IRtcStreamMessageHeader";
3
+ import { IRtcStreamPayload } from "./IRtcStreamPayload";
4
+ export interface IRtcStreamMessage extends IRtcStreamCommunication<"message" | undefined> {
5
+ header: IRtcStreamMessageHeader;
6
+ payload: IRtcStreamPayload;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { IRtcStreamCommunication } from "./IRtcStreamCommunication";
2
+ export interface IRtcStreamMessageChunk extends IRtcStreamCommunication<"message-chunk"> {
3
+ id: number;
4
+ seq: number;
5
+ total: number;
6
+ part: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { IRtcStream } from "../../model/IRtcStream";
2
+ import { Timestamp } from "../../model/Timestamp";
3
+ export interface IRtcStreamMessageHeader {
4
+ stream: IRtcStream;
5
+ created: Timestamp;
6
+ frameId?: string;
7
+ }
@@ -0,0 +1,55 @@
1
+ import { IAudioChunk } from "../../model/IAudioChunk";
2
+ import { ICompressedImage } from "../../model/ICompressedImage";
3
+ import { IGoalID } from "../../model/IGoalID";
4
+ import { IH264VideoFrame } from "../../model/IH264VideoFrame";
5
+ import { IJointState } from "../../model/IJointState";
6
+ import { IJoy } from "../../model/IJoy";
7
+ import { IJsonString } from "../../model/IJsonString";
8
+ import { IMarker3DArray } from "../../model/IMarker3DArray";
9
+ import { IOdometry } from "../../model/IOdometry";
10
+ import { IPoint } from "../../model/IPoint";
11
+ import { IPoseWithCovariance } from "../../model/IPoseWithCovariance";
12
+ import { ITransform } from "../../model/ITransform";
13
+ import { ITwist } from "../../model/ITwist";
14
+ import { Timestamp } from "../../model/Timestamp";
15
+ import { IPingPayload } from "./IPingPayload";
16
+ import { IRtcAgentInfo } from "./IRtcAgentInfo";
17
+ import { IRtcPointCloud } from "./IRtcPointCloud";
18
+ import { IRtcStreamsInfo } from "./IRtcStreamsInfo";
19
+ import { IStreamControl } from "./IStreamControl";
20
+ export interface IRtcStreamPayload {
21
+ ping?: Timestamp;
22
+ pong?: Timestamp;
23
+ pingV2?: IPingPayload;
24
+ pongV2?: IPingPayload;
25
+ streamControl?: IStreamControl;
26
+ streamsInfo?: IRtcStreamsInfo;
27
+ agentInfo?: IRtcAgentInfo;
28
+ numeric?: {
29
+ value: number;
30
+ };
31
+ boolean?: boolean;
32
+ bitset?: {
33
+ bits: {
34
+ key: string;
35
+ value: boolean;
36
+ }[];
37
+ };
38
+ twist?: ITwist;
39
+ compressedImage?: ICompressedImage;
40
+ pose?: ITransform;
41
+ goalID?: IGoalID;
42
+ h264VideoFrame?: IH264VideoFrame;
43
+ videoMetadata?: {
44
+ [key: string]: string;
45
+ };
46
+ audioChunk?: IAudioChunk;
47
+ jointState?: IJointState;
48
+ poseWithCovariance?: IPoseWithCovariance;
49
+ pointCloud?: IRtcPointCloud;
50
+ point?: IPoint;
51
+ markerArray?: IMarker3DArray;
52
+ jsonString?: IJsonString;
53
+ odometry?: IOdometry;
54
+ joy?: IJoy;
55
+ }
@@ -0,0 +1,9 @@
1
+ import { Timestamp } from "../../model/Timestamp";
2
+ export interface IRtcStreamsInfo {
3
+ items: {
4
+ streamId: string;
5
+ sentCount: number;
6
+ receivedCount: number;
7
+ }[];
8
+ timestamp: Timestamp;
9
+ }