livekit-client 2.22.3 → 2.23.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/README.md +35 -0
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +71 -8
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +1746 -547
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.fm.worker.js +1 -1
- package/dist/livekit-client.fm.worker.js.map +1 -1
- package/dist/livekit-client.fm.worker.mjs +2 -1
- package/dist/livekit-client.fm.worker.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +4 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/api/WebSocketStream.d.ts +1 -0
- package/dist/src/api/WebSocketStream.d.ts.map +1 -1
- package/dist/src/api/utils.d.ts +1 -1
- package/dist/src/api/utils.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts +12 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/options.d.ts +14 -0
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/room/DefaultReconnectPolicy.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +100 -7
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +16 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +54 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-channel/DataChannelManager.d.ts +9 -8
- package/dist/src/room/data-channel/DataChannelManager.d.ts.map +1 -1
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts +25 -12
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/LossyDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/ReliableDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +18 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +3 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +4 -0
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
- package/dist/src/room/rpc/utils.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +24 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +18 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +9 -0
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +6 -0
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/processor/types.d.ts +11 -0
- package/dist/src/room/track/processor/types.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +13 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +60 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/compressionStreamStubs.d.ts +12 -0
- package/dist/src/test/compressionStreamStubs.d.ts.map +1 -0
- package/dist/ts4.2/api/SignalClient.d.ts +187 -185
- package/dist/ts4.2/api/SignalClientStateMachine.d.ts +85 -85
- package/dist/ts4.2/api/WebSocketStream.d.ts +34 -33
- package/dist/ts4.2/api/utils.d.ts +9 -9
- package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +30 -30
- package/dist/ts4.2/connectionHelper/checks/Checker.d.ts +62 -62
- package/dist/ts4.2/connectionHelper/checks/cloudRegion.d.ts +18 -18
- package/dist/ts4.2/connectionHelper/checks/connectionProtocol.d.ts +20 -20
- package/dist/ts4.2/connectionHelper/checks/publishAudio.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/publishVideo.d.ts +7 -7
- package/dist/ts4.2/connectionHelper/checks/reconnect.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/turn.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/webrtc.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/websocket.d.ts +6 -6
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +111 -111
- package/dist/ts4.2/e2ee/KeyProvider.d.ts +54 -54
- package/dist/ts4.2/e2ee/constants.d.ts +21 -21
- package/dist/ts4.2/e2ee/errors.d.ts +12 -12
- package/dist/ts4.2/e2ee/events.d.ts +39 -39
- package/dist/ts4.2/e2ee/index.d.ts +6 -6
- package/dist/ts4.2/e2ee/types.d.ts +231 -231
- package/dist/ts4.2/e2ee/utils.d.ts +32 -32
- package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +16 -16
- package/dist/ts4.2/e2ee/worker/ErrorRateLimiter.d.ts +21 -21
- package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +209 -209
- package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +81 -84
- package/dist/ts4.2/e2ee/worker/e2ee.worker.d.ts +2 -2
- package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +39 -28
- package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +23 -23
- package/dist/ts4.2/frameMetadata/FrameMetadataManager.d.ts +53 -53
- package/dist/ts4.2/frameMetadata/frameMetadata.d.ts +33 -33
- package/dist/ts4.2/frameMetadata/types.d.ts +62 -62
- package/dist/ts4.2/frameMetadata/utils.d.ts +9 -9
- package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -2
- package/dist/ts4.2/index.d.ts +76 -76
- package/dist/ts4.2/logger.d.ts +66 -66
- package/dist/ts4.2/options.d.ts +163 -149
- package/dist/ts4.2/room/BackOffStrategy.d.ts +27 -27
- package/dist/ts4.2/room/DefaultReconnectPolicy.d.ts +8 -8
- package/dist/ts4.2/room/DeviceManager.d.ts +12 -12
- package/dist/ts4.2/room/PCTransport.d.ts +268 -175
- package/dist/ts4.2/room/PCTransportManager.d.ts +77 -77
- package/dist/ts4.2/room/RTCEngine.d.ts +277 -262
- package/dist/ts4.2/room/ReconnectPolicy.d.ts +24 -24
- package/dist/ts4.2/room/RegionUrlProvider.d.ts +36 -36
- package/dist/ts4.2/room/Room.d.ts +407 -365
- package/dist/ts4.2/room/attribute-typings.d.ts +35 -35
- package/dist/ts4.2/room/data-channel/DataChannelManager.d.ts +63 -62
- package/dist/ts4.2/room/data-channel/FlowControlledDataChannel.d.ts +107 -95
- package/dist/ts4.2/room/data-channel/LossyDataChannel.d.ts +41 -41
- package/dist/ts4.2/room/data-channel/ReliableDataChannel.d.ts +57 -57
- package/dist/ts4.2/room/data-channel/types.d.ts +12 -12
- package/dist/ts4.2/room/data-stream/compression.d.ts +49 -49
- package/dist/ts4.2/room/data-stream/constants.d.ts +18 -18
- package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +29 -29
- package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +80 -80
- package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +73 -73
- package/dist/ts4.2/room/data-stream/outgoing/StreamWriter.d.ts +16 -16
- package/dist/ts4.2/room/data-stream/outgoing/header-utils.d.ts +18 -18
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +79 -80
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +50 -50
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +59 -59
- package/dist/ts4.2/room/data-track/frame.d.ts +22 -22
- package/dist/ts4.2/room/data-track/handle.d.ts +27 -27
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +124 -124
- package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -24
- package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +41 -41
- package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -20
- package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +126 -126
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +74 -74
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +23 -23
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +48 -48
- package/dist/ts4.2/room/data-track/packet/constants.d.ts +20 -20
- package/dist/ts4.2/room/data-track/packet/errors.d.ts +40 -40
- package/dist/ts4.2/room/data-track/packet/extensions.d.ts +69 -69
- package/dist/ts4.2/room/data-track/packet/index.d.ts +98 -98
- package/dist/ts4.2/room/data-track/packet/serializable.d.ts +13 -13
- package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -43
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -23
- package/dist/ts4.2/room/data-track/types.d.ts +22 -22
- package/dist/ts4.2/room/data-track/utils.d.ts +60 -60
- package/dist/ts4.2/room/debounce.d.ts +11 -11
- package/dist/ts4.2/room/defaults.d.ts +9 -9
- package/dist/ts4.2/room/errors.d.ts +180 -162
- package/dist/ts4.2/room/events.d.ts +638 -637
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +291 -287
- package/dist/ts4.2/room/participant/Participant.d.ts +142 -144
- package/dist/ts4.2/room/participant/ParticipantTrackPermission.d.ts +26 -26
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +85 -86
- package/dist/ts4.2/room/participant/publishUtils.d.ts +53 -53
- package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -43
- package/dist/ts4.2/room/rpc/client/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/index.d.ts +7 -7
- package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -44
- package/dist/ts4.2/room/rpc/server/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/utils.d.ts +131 -131
- package/dist/ts4.2/room/stats.d.ts +71 -71
- package/dist/ts4.2/room/statsSummary.d.ts +13 -13
- package/dist/ts4.2/room/timers.d.ts +12 -12
- package/dist/ts4.2/room/token-source/TokenSource.d.ts +82 -82
- package/dist/ts4.2/room/token-source/types.d.ts +70 -70
- package/dist/ts4.2/room/token-source/utils.d.ts +8 -8
- package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -19
- package/dist/ts4.2/room/track/LocalAudioTrack.d.ts +62 -42
- package/dist/ts4.2/room/track/LocalTrack.d.ts +143 -125
- package/dist/ts4.2/room/track/LocalTrackPublication.d.ts +42 -42
- package/dist/ts4.2/room/track/LocalVideoTrack.d.ts +109 -100
- package/dist/ts4.2/room/track/RemoteAudioTrack.d.ts +61 -55
- package/dist/ts4.2/room/track/RemoteTrack.d.ts +38 -38
- package/dist/ts4.2/room/track/RemoteTrackPublication.d.ts +72 -75
- package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +73 -76
- package/dist/ts4.2/room/track/Track.d.ts +156 -166
- package/dist/ts4.2/room/track/TrackPublication.d.ts +75 -81
- package/dist/ts4.2/room/track/create.d.ts +25 -25
- package/dist/ts4.2/room/track/facingMode.d.ts +41 -41
- package/dist/ts4.2/room/track/options.d.ts +403 -403
- package/dist/ts4.2/room/track/processor/types.d.ts +42 -31
- package/dist/ts4.2/room/track/record.d.ts +13 -13
- package/dist/ts4.2/room/track/types.d.ts +28 -28
- package/dist/ts4.2/room/track/utils.d.ts +60 -47
- package/dist/ts4.2/room/types.d.ts +127 -127
- package/dist/ts4.2/room/utils.d.ts +273 -214
- package/dist/ts4.2/test/MockMediaStreamTrack.d.ts +26 -26
- package/dist/ts4.2/test/compressionStreamStubs.d.ts +12 -0
- package/dist/ts4.2/test/mocks.d.ts +12 -12
- package/dist/ts4.2/test/promiseState.d.ts +12 -12
- package/dist/ts4.2/test/signalToken.d.ts +26 -26
- package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -2
- package/dist/ts4.2/utils/AsyncQueue.d.ts +23 -23
- package/dist/ts4.2/utils/TypedPromise.d.ts +17 -17
- package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -13
- package/dist/ts4.2/utils/browserParser.d.ts +13 -13
- package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -8
- package/dist/ts4.2/utils/cloneDeep.d.ts +2 -2
- package/dist/ts4.2/utils/dataPacketBuffer.d.ts +34 -34
- package/dist/ts4.2/utils/deferrable-map.d.ts +32 -32
- package/dist/ts4.2/utils/machineInspector.d.ts +54 -54
- package/dist/ts4.2/utils/serializer.d.ts +48 -48
- package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -15
- package/dist/ts4.2/utils/ttlmap.d.ts +20 -20
- package/dist/ts4.2/version.d.ts +15 -15
- package/package.json +5 -4
- package/src/api/SignalClient.e2e.test.ts +1 -3
- package/src/api/SignalClient.test.ts +394 -10
- package/src/api/SignalClient.ts +132 -76
- package/src/api/WebSocketStream.test.ts +11 -0
- package/src/api/WebSocketStream.ts +22 -1
- package/src/api/utils.ts +1 -1
- package/src/e2ee/E2eeManager.test.ts +43 -0
- package/src/e2ee/E2eeManager.ts +6 -2
- package/src/e2ee/worker/FrameCryptor.test.ts +212 -90
- package/src/e2ee/worker/FrameCryptor.ts +21 -4
- package/src/e2ee/worker/naluUtils.test.ts +123 -0
- package/src/e2ee/worker/naluUtils.ts +57 -2
- package/src/index.ts +2 -0
- package/src/options.ts +16 -0
- package/src/room/DefaultReconnectPolicy.test.ts +58 -0
- package/src/room/DefaultReconnectPolicy.ts +14 -2
- package/src/room/PCTransport.test.ts +327 -9
- package/src/room/PCTransport.ts +339 -36
- package/src/room/PCTransportManager.ts +3 -1
- package/src/room/RTCEngine.test.ts +318 -2
- package/src/room/RTCEngine.ts +126 -12
- package/src/room/Room.test.ts +148 -6
- package/src/room/Room.ts +312 -80
- package/src/room/data-channel/DataChannelManager.test.ts +24 -7
- package/src/room/data-channel/DataChannelManager.ts +43 -38
- package/src/room/data-channel/FlowControlledDataChannel.test.ts +60 -18
- package/src/room/data-channel/FlowControlledDataChannel.ts +40 -22
- package/src/room/data-channel/LossyDataChannel.test.ts +38 -0
- package/src/room/data-channel/LossyDataChannel.ts +10 -1
- package/src/room/data-channel/ReliableDataChannel.test.ts +72 -0
- package/src/room/data-channel/ReliableDataChannel.ts +16 -5
- package/src/room/data-stream/incoming/IncomingDataStreamManager.test.ts +47 -20
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +16 -5
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.test.ts +60 -39
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +4 -4
- package/src/room/defaults.ts +1 -0
- package/src/room/errors.test.ts +36 -0
- package/src/room/errors.ts +27 -0
- package/src/room/events.ts +2 -1
- package/src/room/participant/LocalParticipant.test.ts +136 -1
- package/src/room/participant/LocalParticipant.ts +66 -17
- package/src/room/participant/Participant.ts +6 -3
- package/src/room/participant/publishUtils.ts +0 -19
- package/src/room/participant/restartOnDefaultAudioDevice.test.ts +177 -0
- package/src/room/rpc/client/RpcClientManager.test.ts +51 -0
- package/src/room/rpc/client/RpcClientManager.ts +32 -15
- package/src/room/rpc/utils.test.ts +32 -0
- package/src/room/rpc/utils.ts +7 -0
- package/src/room/track/LocalAudioTrack.ts +101 -10
- package/src/room/track/LocalTrack.ts +87 -19
- package/src/room/track/LocalVideoTrack.ts +17 -3
- package/src/room/track/RemoteAudioTrack.ts +59 -14
- package/src/room/track/RemoteVideoTrack.test.ts +210 -0
- package/src/room/track/RemoteVideoTrack.ts +29 -3
- package/src/room/track/processor/types.ts +11 -0
- package/src/room/track/utils.test.ts +206 -2
- package/src/room/track/utils.ts +117 -5
- package/src/room/utils.test.ts +250 -0
- package/src/room/utils.ts +152 -19
- package/src/test/compressionStreamStubs.ts +53 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export interface AgentAttributes {
|
|
2
|
-
'lk.agent.inputs'?: AgentInput[];
|
|
3
|
-
'lk.agent.outputs'?: AgentOutput[];
|
|
4
|
-
'lk.agent.state'?: AgentState;
|
|
5
|
-
'lk.publish_on_behalf'?: string;
|
|
6
|
-
[property: string]: any;
|
|
7
|
-
}
|
|
8
|
-
export type AgentInput = 'audio' | 'video' | 'text';
|
|
9
|
-
export type AgentOutput = 'transcription' | 'audio';
|
|
10
|
-
export type AgentState = 'idle' | 'initializing' | 'listening' | 'thinking' | 'speaking';
|
|
11
|
-
/**
|
|
12
|
-
* Schema for transcription-related attributes
|
|
13
|
-
*/
|
|
14
|
-
export interface TranscriptionAttributes {
|
|
15
|
-
/**
|
|
16
|
-
* The segment id of the transcription
|
|
17
|
-
*/
|
|
18
|
-
'lk.segment_id'?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The associated track id of the transcription
|
|
21
|
-
*/
|
|
22
|
-
'lk.transcribed_track_id'?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the transcription is final
|
|
25
|
-
*/
|
|
26
|
-
'lk.transcription_final'?: boolean;
|
|
27
|
-
[property: string]: any;
|
|
28
|
-
}
|
|
29
|
-
export declare class Convert {
|
|
30
|
-
static toAgentAttributes(json: string): AgentAttributes;
|
|
31
|
-
static agentAttributesToJson(value: AgentAttributes): string;
|
|
32
|
-
static toTranscriptionAttributes(json: string): TranscriptionAttributes;
|
|
33
|
-
static transcriptionAttributesToJson(value: TranscriptionAttributes): string;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=attribute-typings.d.ts.map
|
|
1
|
+
export interface AgentAttributes {
|
|
2
|
+
'lk.agent.inputs'?: AgentInput[];
|
|
3
|
+
'lk.agent.outputs'?: AgentOutput[];
|
|
4
|
+
'lk.agent.state'?: AgentState;
|
|
5
|
+
'lk.publish_on_behalf'?: string;
|
|
6
|
+
[property: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export type AgentInput = 'audio' | 'video' | 'text';
|
|
9
|
+
export type AgentOutput = 'transcription' | 'audio';
|
|
10
|
+
export type AgentState = 'idle' | 'initializing' | 'listening' | 'thinking' | 'speaking';
|
|
11
|
+
/**
|
|
12
|
+
* Schema for transcription-related attributes
|
|
13
|
+
*/
|
|
14
|
+
export interface TranscriptionAttributes {
|
|
15
|
+
/**
|
|
16
|
+
* The segment id of the transcription
|
|
17
|
+
*/
|
|
18
|
+
'lk.segment_id'?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The associated track id of the transcription
|
|
21
|
+
*/
|
|
22
|
+
'lk.transcribed_track_id'?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the transcription is final
|
|
25
|
+
*/
|
|
26
|
+
'lk.transcription_final'?: boolean;
|
|
27
|
+
[property: string]: any;
|
|
28
|
+
}
|
|
29
|
+
export declare class Convert {
|
|
30
|
+
static toAgentAttributes(json: string): AgentAttributes;
|
|
31
|
+
static agentAttributesToJson(value: AgentAttributes): string;
|
|
32
|
+
static toTranscriptionAttributes(json: string): TranscriptionAttributes;
|
|
33
|
+
static transcriptionAttributesToJson(value: TranscriptionAttributes): string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=attribute-typings.d.ts.map
|
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
import type { PCTransportManager } from '../PCTransportManager';
|
|
2
|
-
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
3
|
-
import { LossyDataChannel } from './LossyDataChannel';
|
|
4
|
-
import { ReliableDataChannel } from './ReliableDataChannel';
|
|
5
|
-
import { DataChannelKind } from './types';
|
|
6
|
-
export interface DataChannelManagerOptions {
|
|
7
|
-
/** Whether the owning engine has been closed — a closed engine rejects headroom waiters. */
|
|
8
|
-
isEngineClosed: () => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Whether a reconnect attempt is underway: reliable sends defer to the resume replay and lossy
|
|
11
|
-
* sends are skipped while this is true.
|
|
12
|
-
*/
|
|
13
|
-
isReconnecting: () => boolean;
|
|
14
|
-
onDataMessage: (message: MessageEvent) => void;
|
|
15
|
-
onDataTrackMessage: (message: MessageEvent) => void;
|
|
16
|
-
onDataError: (event: Event) => void;
|
|
17
|
-
onChannelClose: (kind: DataChannelKind) => void;
|
|
18
|
-
/** A channel's buffer crossed its low-water mark (debounced). Drives DCBufferStatusChanged. */
|
|
19
|
-
onBufferStatusChanged: (kind: DataChannelKind, isLow: boolean) => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Owns the engine's data channels: the three flow-controlled publisher channel wrappers (which
|
|
23
|
-
* live for the engine's lifetime and have RTCDataChannel handles attached/detached as peer
|
|
24
|
-
* connections come and go) plus the subscriber-side receive handles adopted by label.
|
|
25
|
-
*
|
|
26
|
-
* Handle turnover goes through {@link FlowControlledDataChannel.attach}/`detach`, which
|
|
27
|
-
* parked headroom waiters as a built-in — there is no separate
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
* channel objects
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* the
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import type { PCTransportManager } from '../PCTransportManager';
|
|
2
|
+
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
3
|
+
import { LossyDataChannel } from './LossyDataChannel';
|
|
4
|
+
import { ReliableDataChannel } from './ReliableDataChannel';
|
|
5
|
+
import { DataChannelKind } from './types';
|
|
6
|
+
export interface DataChannelManagerOptions {
|
|
7
|
+
/** Whether the owning engine has been closed — a closed engine rejects headroom waiters. */
|
|
8
|
+
isEngineClosed: () => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a reconnect attempt is underway: reliable sends defer to the resume replay and lossy
|
|
11
|
+
* sends are skipped while this is true.
|
|
12
|
+
*/
|
|
13
|
+
isReconnecting: () => boolean;
|
|
14
|
+
onDataMessage: (message: MessageEvent) => void;
|
|
15
|
+
onDataTrackMessage: (message: MessageEvent) => void;
|
|
16
|
+
onDataError: (event: Event) => void;
|
|
17
|
+
onChannelClose: (kind: DataChannelKind) => void;
|
|
18
|
+
/** A channel's buffer crossed its low-water mark (debounced). Drives DCBufferStatusChanged. */
|
|
19
|
+
onBufferStatusChanged: (kind: DataChannelKind, isLow: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Owns the engine's data channels: the three flow-controlled publisher channel wrappers (which
|
|
23
|
+
* live for the engine's lifetime and have RTCDataChannel handles attached/detached as peer
|
|
24
|
+
* connections come and go) plus the subscriber-side receive handles adopted by label.
|
|
25
|
+
*
|
|
26
|
+
* Handle turnover goes through {@link FlowControlledDataChannel.attach}/`detach`, which close the
|
|
27
|
+
* released handle and reject parked headroom waiters as a built-in — there is no separate
|
|
28
|
+
* invalidation step to forget.
|
|
29
|
+
*/
|
|
30
|
+
export declare class DataChannelManager {
|
|
31
|
+
readonly reliable: ReliableDataChannel;
|
|
32
|
+
readonly lossy: LossyDataChannel;
|
|
33
|
+
readonly dataTrack: LossyDataChannel;
|
|
34
|
+
private reliableSub?;
|
|
35
|
+
private lossySub?;
|
|
36
|
+
private dataTrackSub?;
|
|
37
|
+
private opts;
|
|
38
|
+
constructor(opts: DataChannelManagerOptions);
|
|
39
|
+
/** The flow-control wrapper for `kind`. */
|
|
40
|
+
channelFor(kind: DataChannelKind): FlowControlledDataChannel;
|
|
41
|
+
/** The raw RTCDataChannel handle for `kind`, publisher side by default. */
|
|
42
|
+
getHandle(kind: DataChannelKind, subscriber?: boolean): RTCDataChannel | undefined;
|
|
43
|
+
get hasPublisherChannels(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Creates the three publisher data channels on the given transport, wires their handlers, and
|
|
46
|
+
* attaches them to the wrappers — attaching closes any replaced channel objects and rejects the
|
|
47
|
+
* waiters still parked on them.
|
|
48
|
+
*/
|
|
49
|
+
createPublisherChannels(pcManager: PCTransportManager): void;
|
|
50
|
+
/**
|
|
51
|
+
* Adopts a subscriber-side data channel by label, wiring the matching receive handler.
|
|
52
|
+
* Returns false for labels this manager doesn't own.
|
|
53
|
+
*/
|
|
54
|
+
adoptSubscriberChannel(channel: RTCDataChannel): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Tears down all channels for a peer-connection cleanup: strips handlers, closes the handles,
|
|
57
|
+
* and resets the reliable session state. Detaching the publisher handles closes them and
|
|
58
|
+
* rejects parked waiters (the spec allows `pc.close()` to transition channels to 'closed'
|
|
59
|
+
* without firing events, so waiting for browser close events is not an option).
|
|
60
|
+
*/
|
|
61
|
+
teardown(): void;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=DataChannelManager.d.ts.map
|
|
@@ -1,95 +1,107 @@
|
|
|
1
|
-
import type { DataChannelKind } from './types';
|
|
2
|
-
export interface FlowControlledDataChannelOptions {
|
|
3
|
-
kind: DataChannelKind;
|
|
4
|
-
/** Buffer level (bytes) at which blocked senders resume; armed as `bufferedAmountLowThreshold`. */
|
|
5
|
-
lowWaterMark: number;
|
|
6
|
-
/** Buffer level (bytes) above which senders block until the buffer drains to the low mark. */
|
|
7
|
-
highWaterMark: number;
|
|
8
|
-
/** Whether the owning engine has been closed — a closed engine rejects waiters immediately. */
|
|
9
|
-
isEngineClosed: () => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Notified when the buffer crosses the low-water mark in either direction (debounced: fires only
|
|
12
|
-
* on an actual change). Drives the engine's public DCBufferStatusChanged event.
|
|
13
|
-
*/
|
|
14
|
-
onBufferStatusChanged?: (isLow: boolean) => void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Two-watermark flow control for one data channel kind.
|
|
18
|
-
*
|
|
19
|
-
* Owns the per-kind headroom gate: senders proceed freely while the buffer is at or below the
|
|
20
|
-
* high-water mark and otherwise block — serialized FIFO through a mutex — until the browser's
|
|
21
|
-
* `bufferedamountlow` event (armed at the low-water mark) signals the buffer has drained. The
|
|
22
|
-
* serialization prevents woken senders from all refilling at once and overflowing the SCTP send
|
|
23
|
-
* buffer (see livekit/client-sdk-js#1995).
|
|
24
|
-
*
|
|
25
|
-
* Waiters are parked on the channel object captured at wait entry. If that object stops being
|
|
26
|
-
* current — replaced or torn down — its events may never fire again, so the owner must call
|
|
27
|
-
* {@link invalidateWaiters}, which aborts parked waiters (releasing the gate); the next waiter
|
|
28
|
-
* gets a fresh controller.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
private
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
get channelHandle(): RTCDataChannel | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Attaches the channel handle this wrapper controls. Replacing an existing handle
|
|
47
|
-
* parked waiters — their events would never fire again on the abandoned object — and
|
|
48
|
-
* fresh controller
|
|
49
|
-
*
|
|
50
|
-
* waiter structurally impossible.
|
|
51
|
-
*/
|
|
52
|
-
attach(dc: RTCDataChannel): void;
|
|
53
|
-
/** Detaches the handle on teardown, rejecting parked waiters. */
|
|
54
|
-
detach(reason?: string): void;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
1
|
+
import type { DataChannelKind } from './types';
|
|
2
|
+
export interface FlowControlledDataChannelOptions {
|
|
3
|
+
kind: DataChannelKind;
|
|
4
|
+
/** Buffer level (bytes) at which blocked senders resume; armed as `bufferedAmountLowThreshold`. */
|
|
5
|
+
lowWaterMark: number;
|
|
6
|
+
/** Buffer level (bytes) above which senders block until the buffer drains to the low mark. */
|
|
7
|
+
highWaterMark: number;
|
|
8
|
+
/** Whether the owning engine has been closed — a closed engine rejects waiters immediately. */
|
|
9
|
+
isEngineClosed: () => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Notified when the buffer crosses the low-water mark in either direction (debounced: fires only
|
|
12
|
+
* on an actual change). Drives the engine's public DCBufferStatusChanged event.
|
|
13
|
+
*/
|
|
14
|
+
onBufferStatusChanged?: (isLow: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Two-watermark flow control for one data channel kind.
|
|
18
|
+
*
|
|
19
|
+
* Owns the per-kind headroom gate: senders proceed freely while the buffer is at or below the
|
|
20
|
+
* high-water mark and otherwise block — serialized FIFO through a mutex — until the browser's
|
|
21
|
+
* `bufferedamountlow` event (armed at the low-water mark) signals the buffer has drained. The
|
|
22
|
+
* serialization prevents woken senders from all refilling at once and overflowing the SCTP send
|
|
23
|
+
* buffer (see livekit/client-sdk-js#1995).
|
|
24
|
+
*
|
|
25
|
+
* Waiters are parked on the channel object captured at wait entry. If that object stops being
|
|
26
|
+
* current — replaced or torn down — its events may never fire again, so the owner must call
|
|
27
|
+
* {@link invalidateWaiters}, which aborts parked waiters (releasing the gate); the next waiter
|
|
28
|
+
* gets a fresh controller. {@link attach} and {@link detach} do this, and close the released
|
|
29
|
+
* handle, as part of handle turnover.
|
|
30
|
+
*/
|
|
31
|
+
export declare class FlowControlledDataChannel {
|
|
32
|
+
readonly kind: DataChannelKind;
|
|
33
|
+
readonly lowWaterMark: number;
|
|
34
|
+
readonly highWaterMark: number;
|
|
35
|
+
protected isEngineClosed: () => boolean;
|
|
36
|
+
private onBufferStatusChanged?;
|
|
37
|
+
/** Last emitted low-water status; starts true (an empty buffer is below the mark). */
|
|
38
|
+
private bufferStatusLow;
|
|
39
|
+
private handle?;
|
|
40
|
+
private headroomLock;
|
|
41
|
+
/** Cancels parked headroom waiters when the handle is replaced or torn down. */
|
|
42
|
+
private waiterAbortController;
|
|
43
|
+
constructor(opts: FlowControlledDataChannelOptions);
|
|
44
|
+
get channelHandle(): (RTCDataChannel | undefined);
|
|
45
|
+
/**
|
|
46
|
+
* Attaches the channel handle this wrapper controls. Replacing an existing handle closes it and
|
|
47
|
+
* rejects parked waiters — their events would never fire again on the abandoned object — and
|
|
48
|
+
* installs a fresh controller. Wrappers outlive their handles: this is the one place handle
|
|
49
|
+
* turnover happens, so a handle the wrapper lets go of is never left open, and stranding a
|
|
50
|
+
* waiter is structurally impossible.
|
|
51
|
+
*/
|
|
52
|
+
attach(dc: RTCDataChannel): void;
|
|
53
|
+
/** Detaches and closes the handle on teardown, rejecting parked waiters. */
|
|
54
|
+
detach(reason?: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Closes a handle the wrapper no longer controls. `close()` moves it to `closing` synchronously,
|
|
57
|
+
* so senders still holding it (queued on the headroom lock) fail the open check once they get
|
|
58
|
+
* the lock. Parked waiters are aborted directly instead of relying on the `close` event, which
|
|
59
|
+
* fires asynchronously, if at all (the spec lets `pc.close()` skip it). Strip any handlers that
|
|
60
|
+
* must not observe the close before calling this.
|
|
61
|
+
*/
|
|
62
|
+
private release;
|
|
63
|
+
protected getChannel(): RTCDataChannel | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the send buffer has room to accept more data (the send gate). Senders proceed while
|
|
66
|
+
* this is true and block once it goes false. Callers resolve the handle (and decide what an
|
|
67
|
+
* absent one means) before asking.
|
|
68
|
+
*/
|
|
69
|
+
isBelowHighWaterMark(dc: RTCDataChannel): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the send buffer has drained to its low-water mark. Drives the engine's public
|
|
72
|
+
* DCBufferStatusChanged event.
|
|
73
|
+
*/
|
|
74
|
+
isBelowLowWaterMark(dc: RTCDataChannel): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Acquires the headroom lock, resolving with the unlock function. Batch senders (the resume
|
|
77
|
+
* replay) hold it across all of their sends so no other sender can interleave, calling
|
|
78
|
+
* {@link waitForHeadroomWithoutLock} per message to respect flow control within the batch.
|
|
79
|
+
*/
|
|
80
|
+
lockHeadroom(): Promise<() => void>;
|
|
81
|
+
/**
|
|
82
|
+
* Resolves once the caller may send on `dc`: immediately while its send buffer is at or below
|
|
83
|
+
* the high-water mark, otherwise once the buffer has drained to the low-water mark (the
|
|
84
|
+
* `bufferedamountlow` event). Callers are serialized through the headroom lock so that, when
|
|
85
|
+
* the buffer drains, they refill it one at a time (up to the high-water mark) rather than all
|
|
86
|
+
* sending at once and overflowing the SCTP send buffer (see livekit/client-sdk-js#1995). The
|
|
87
|
+
* checks run inside the lock so queued callers proceed in FIFO order.
|
|
88
|
+
*
|
|
89
|
+
* The caller passes the handle it resolved before queueing, and the wait is against that one
|
|
90
|
+
* handle throughout: if it was replaced meanwhile, it has been closed, so the wait rejects
|
|
91
|
+
* rather than letting the caller send on the replacement out of turn.
|
|
92
|
+
*/
|
|
93
|
+
waitForHeadroomWithLock(dc: RTCDataChannel): Promise<void>;
|
|
94
|
+
/** Core wait of {@link waitForHeadroomWithLock}. The caller must hold the headroom lock. */
|
|
95
|
+
waitForHeadroomWithoutLock(dc: RTCDataChannel): Promise<void>;
|
|
96
|
+
/** Rejects all parked headroom waiters; the next waiter gets a fresh controller. */
|
|
97
|
+
invalidateWaiters(reason: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Recomputes whether the buffer has drained to the low-water mark and, if that changed since the
|
|
100
|
+
* last check, notifies the status listener. Two independent triggers land here: a send (which
|
|
101
|
+
* raises the buffer) and the `bufferedamountlow` drain event (which lowers it) — the latter has
|
|
102
|
+
* no send to hang the work off, which is why this is a shared entry point rather than a tail of
|
|
103
|
+
* `send`.
|
|
104
|
+
*/
|
|
105
|
+
refreshBufferStatus(): void;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=FlowControlledDataChannel.d.ts.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
2
|
-
import type { FlowControlledDataChannelOptions } from './FlowControlledDataChannel';
|
|
3
|
-
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
4
|
-
export interface LossyDataChannelOptions extends FlowControlledDataChannelOptions {
|
|
5
|
-
/**
|
|
6
|
-
* What to do with a send while the buffer is full: `drop` discards it to keep latency bounded
|
|
7
|
-
* (the classic lossy channel), `wait` backpressures the producer until there is headroom (the
|
|
8
|
-
* data-track channel, whose producer decides what to skip at frame granularity).
|
|
9
|
-
*/
|
|
10
|
-
bufferFullBehavior: 'drop' | 'wait';
|
|
11
|
-
/** Sends are silently discarded while this is true (a reconnect attempt is underway). */
|
|
12
|
-
shouldSkipSends: () => boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A lossy channel: flow control plus a per-instance full-buffer policy.
|
|
16
|
-
*
|
|
17
|
-
* Each instance owns its own byterate stat, drop counter, and (when tuning is started) the
|
|
18
|
-
* dynamic `bufferedAmountLowThreshold` adjustment that keeps the drop gate at roughly 100ms of
|
|
19
|
-
* buffered latency. Keeping these per instance is what prevents one channel's traffic from
|
|
20
|
-
* steering another channel's policy.
|
|
21
|
-
*/
|
|
22
|
-
export declare class LossyDataChannel extends FlowControlledDataChannel {
|
|
23
|
-
private bufferFullBehavior;
|
|
24
|
-
private shouldSkipSends;
|
|
25
|
-
private statCurrentBytes;
|
|
26
|
-
private statByterate;
|
|
27
|
-
private statInterval;
|
|
28
|
-
private dropCount;
|
|
29
|
-
constructor(opts: LossyDataChannelOptions);
|
|
30
|
-
/** Sends prepared bytes with this channel's full-buffer policy (drop or wait). */
|
|
31
|
-
send(msg: NonSharedUint8Array): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Starts the once-per-second adjustment of the channel's `bufferedAmountLowThreshold` to the
|
|
34
|
-
* observed byterate, keeping the drop gate at roughly 100ms of buffered latency (clamped to
|
|
35
|
-
* the watermarks). Restarts cleanly if already running.
|
|
36
|
-
*/
|
|
37
|
-
startThresholdTuning(): void;
|
|
38
|
-
/** Stops the threshold tuning and resets the stats and drop counter. */
|
|
39
|
-
stopThresholdTuning(): void;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=LossyDataChannel.d.ts.map
|
|
1
|
+
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
2
|
+
import type { FlowControlledDataChannelOptions } from './FlowControlledDataChannel';
|
|
3
|
+
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
4
|
+
export interface LossyDataChannelOptions extends FlowControlledDataChannelOptions {
|
|
5
|
+
/**
|
|
6
|
+
* What to do with a send while the buffer is full: `drop` discards it to keep latency bounded
|
|
7
|
+
* (the classic lossy channel), `wait` backpressures the producer until there is headroom (the
|
|
8
|
+
* data-track channel, whose producer decides what to skip at frame granularity).
|
|
9
|
+
*/
|
|
10
|
+
bufferFullBehavior: 'drop' | 'wait';
|
|
11
|
+
/** Sends are silently discarded while this is true (a reconnect attempt is underway). */
|
|
12
|
+
shouldSkipSends: () => boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A lossy channel: flow control plus a per-instance full-buffer policy.
|
|
16
|
+
*
|
|
17
|
+
* Each instance owns its own byterate stat, drop counter, and (when tuning is started) the
|
|
18
|
+
* dynamic `bufferedAmountLowThreshold` adjustment that keeps the drop gate at roughly 100ms of
|
|
19
|
+
* buffered latency. Keeping these per instance is what prevents one channel's traffic from
|
|
20
|
+
* steering another channel's policy.
|
|
21
|
+
*/
|
|
22
|
+
export declare class LossyDataChannel extends FlowControlledDataChannel {
|
|
23
|
+
private bufferFullBehavior;
|
|
24
|
+
private shouldSkipSends;
|
|
25
|
+
private statCurrentBytes;
|
|
26
|
+
private statByterate;
|
|
27
|
+
private statInterval;
|
|
28
|
+
private dropCount;
|
|
29
|
+
constructor(opts: LossyDataChannelOptions);
|
|
30
|
+
/** Sends prepared bytes with this channel's full-buffer policy (drop or wait). */
|
|
31
|
+
send(msg: NonSharedUint8Array): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Starts the once-per-second adjustment of the channel's `bufferedAmountLowThreshold` to the
|
|
34
|
+
* observed byterate, keeping the drop gate at roughly 100ms of buffered latency (clamped to
|
|
35
|
+
* the watermarks). Restarts cleanly if already running.
|
|
36
|
+
*/
|
|
37
|
+
startThresholdTuning(): void;
|
|
38
|
+
/** Stops the threshold tuning and resets the stats and drop counter. */
|
|
39
|
+
stopThresholdTuning(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=LossyDataChannel.d.ts.map
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
2
|
-
import type { FlowControlledDataChannelOptions } from './FlowControlledDataChannel';
|
|
3
|
-
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
4
|
-
export interface ReliableDataChannelOptions extends FlowControlledDataChannelOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Whether sends should currently be deferred to the resume replay instead of hitting the wire
|
|
7
|
-
* (i.e. a reconnect attempt is underway). Read at send time so the reliable channel matches the
|
|
8
|
-
* engine's reconnect state without owning it.
|
|
9
|
-
*/
|
|
10
|
-
isDeferringSends: () => boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The reliable channel: flow control plus delivery-across-resume semantics.
|
|
14
|
-
*
|
|
15
|
-
* Every packet gets a monotonic sequence (stamped into the protobuf by the caller before
|
|
16
|
-
* serialization, via {@link nextSequence}) and is retained in a replay buffer until the channel's
|
|
17
|
-
* `bufferedAmount` confirms it has been handed to the transport. Sends that land in a reconnect
|
|
18
|
-
* window — or whose headroom wait is torn down transiently — are queued unsent and resolve;
|
|
19
|
-
* {@link replay} delivers them (plus any unacked packets) after a resume. Only an engine close
|
|
20
|
-
* rejects, because no replay is coming after that.
|
|
21
|
-
*/
|
|
22
|
-
export declare class ReliableDataChannel extends FlowControlledDataChannel {
|
|
23
|
-
private messageBuffer;
|
|
24
|
-
private sequence;
|
|
25
|
-
private isDeferringSends;
|
|
26
|
-
constructor(opts: ReliableDataChannelOptions);
|
|
27
|
-
/**
|
|
28
|
-
* Claims the next packet sequence. The caller stamps it into the packet before serialization,
|
|
29
|
-
* then passes it back to {@link send} so the replay buffer stays keyed by wire sequence.
|
|
30
|
-
*/
|
|
31
|
-
nextSequence(): number;
|
|
32
|
-
/**
|
|
33
|
-
* Sends prepared bytes with reliable semantics. Resolves once the packet has either been handed
|
|
34
|
-
* to the channel or queued for the resume replay; throws only when the engine is closed.
|
|
35
|
-
*/
|
|
36
|
-
send(msg: NonSharedUint8Array, sequence: number): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Replays the buffered backlog after a resume: drops everything the server acked
|
|
39
|
-
* (`lastMessageSeq`), then re-sends the rest in order. The headroom lock is held across the
|
|
40
|
-
* whole replay — releasing it between messages would let a concurrent send (whose newer
|
|
41
|
-
* sequence was already assigned before it queued on the lock) hit the wire mid-replay, and
|
|
42
|
-
* receivers would then discard the remaining lower-sequence resent messages as duplicates.
|
|
43
|
-
*/
|
|
44
|
-
replay(lastMessageSeq: number): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Before recomputing status, trim packets the transport has now delivered — a send or a drain
|
|
47
|
-
* may have acked buffered packets, and the replay buffer is keyed off the channel's buffered
|
|
48
|
-
* bytes.
|
|
49
|
-
*/
|
|
50
|
-
refreshBufferStatus(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Drops all replay state and restarts sequencing. Only valid on a full reconnect, where the
|
|
53
|
-
* session (and the receivers' sequence tracking) starts over.
|
|
54
|
-
*/
|
|
55
|
-
reset(): void;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=ReliableDataChannel.d.ts.map
|
|
1
|
+
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
2
|
+
import type { FlowControlledDataChannelOptions } from './FlowControlledDataChannel';
|
|
3
|
+
import { FlowControlledDataChannel } from './FlowControlledDataChannel';
|
|
4
|
+
export interface ReliableDataChannelOptions extends FlowControlledDataChannelOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether sends should currently be deferred to the resume replay instead of hitting the wire
|
|
7
|
+
* (i.e. a reconnect attempt is underway). Read at send time so the reliable channel matches the
|
|
8
|
+
* engine's reconnect state without owning it.
|
|
9
|
+
*/
|
|
10
|
+
isDeferringSends: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The reliable channel: flow control plus delivery-across-resume semantics.
|
|
14
|
+
*
|
|
15
|
+
* Every packet gets a monotonic sequence (stamped into the protobuf by the caller before
|
|
16
|
+
* serialization, via {@link nextSequence}) and is retained in a replay buffer until the channel's
|
|
17
|
+
* `bufferedAmount` confirms it has been handed to the transport. Sends that land in a reconnect
|
|
18
|
+
* window — or whose headroom wait is torn down transiently — are queued unsent and resolve;
|
|
19
|
+
* {@link replay} delivers them (plus any unacked packets) after a resume. Only an engine close
|
|
20
|
+
* rejects, because no replay is coming after that.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ReliableDataChannel extends FlowControlledDataChannel {
|
|
23
|
+
private messageBuffer;
|
|
24
|
+
private sequence;
|
|
25
|
+
private isDeferringSends;
|
|
26
|
+
constructor(opts: ReliableDataChannelOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Claims the next packet sequence. The caller stamps it into the packet before serialization,
|
|
29
|
+
* then passes it back to {@link send} so the replay buffer stays keyed by wire sequence.
|
|
30
|
+
*/
|
|
31
|
+
nextSequence(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Sends prepared bytes with reliable semantics. Resolves once the packet has either been handed
|
|
34
|
+
* to the channel or queued for the resume replay; throws only when the engine is closed.
|
|
35
|
+
*/
|
|
36
|
+
send(msg: NonSharedUint8Array, sequence: number): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Replays the buffered backlog after a resume: drops everything the server acked
|
|
39
|
+
* (`lastMessageSeq`), then re-sends the rest in order. The headroom lock is held across the
|
|
40
|
+
* whole replay — releasing it between messages would let a concurrent send (whose newer
|
|
41
|
+
* sequence was already assigned before it queued on the lock) hit the wire mid-replay, and
|
|
42
|
+
* receivers would then discard the remaining lower-sequence resent messages as duplicates.
|
|
43
|
+
*/
|
|
44
|
+
replay(lastMessageSeq: number): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Before recomputing status, trim packets the transport has now delivered — a send or a drain
|
|
47
|
+
* may have acked buffered packets, and the replay buffer is keyed off the channel's buffered
|
|
48
|
+
* bytes.
|
|
49
|
+
*/
|
|
50
|
+
refreshBufferStatus(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Drops all replay state and restarts sequencing. Only valid on a full reconnect, where the
|
|
53
|
+
* session (and the receivers' sequence tracking) starts over.
|
|
54
|
+
*/
|
|
55
|
+
reset(): void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=ReliableDataChannel.d.ts.map
|