@dtelecom/server-sdk-node 0.1.0 → 0.2.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/index.d.ts +52 -3
- package/dist/index.js +317 -68
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -328,6 +328,11 @@ declare const StreamStateUpdate: {
|
|
|
328
328
|
*
|
|
329
329
|
* Handles binary protobuf signaling: SignalRequest (client→server)
|
|
330
330
|
* and SignalResponse (server→client).
|
|
331
|
+
*
|
|
332
|
+
* Keepalive: sends application-level protobuf pings at the interval specified
|
|
333
|
+
* by the server's JoinResponse (pingInterval / pingTimeout). This matches
|
|
334
|
+
* the official client-sdk-js behaviour. If no pong is received within
|
|
335
|
+
* pingTimeout seconds the connection is considered dead.
|
|
331
336
|
*/
|
|
332
337
|
|
|
333
338
|
interface SignalOptions {
|
|
@@ -356,9 +361,17 @@ interface SignalEvents {
|
|
|
356
361
|
}
|
|
357
362
|
declare class SignalClient extends TypedEmitter<SignalEvents> {
|
|
358
363
|
private ws;
|
|
359
|
-
private pingInterval;
|
|
360
364
|
private _isConnected;
|
|
361
365
|
private joinResponse;
|
|
366
|
+
/** App-level ping interval timer (sends ping every pingInterval seconds). */
|
|
367
|
+
private pingIntervalTimer;
|
|
368
|
+
/** App-level pong timeout timer (fires if no pong within pingTimeout seconds). */
|
|
369
|
+
private pingTimeoutTimer;
|
|
370
|
+
/** Server-provided ping config (seconds). */
|
|
371
|
+
private pingIntervalS;
|
|
372
|
+
private pingTimeoutS;
|
|
373
|
+
/** RTT measured from last ping/pong round-trip. */
|
|
374
|
+
private rtt;
|
|
362
375
|
get isConnected(): boolean;
|
|
363
376
|
/**
|
|
364
377
|
* Connect to the dTelecom SFU signaling server.
|
|
@@ -384,8 +397,17 @@ declare class SignalClient extends TypedEmitter<SignalEvents> {
|
|
|
384
397
|
private buildUrl;
|
|
385
398
|
private sendRequest;
|
|
386
399
|
private handleResponse;
|
|
387
|
-
|
|
388
|
-
|
|
400
|
+
/**
|
|
401
|
+
* Send app-level ping (both legacy and new format, matching client-sdk-js).
|
|
402
|
+
* Proto: SignalRequest.ping (field 14) + SignalRequest.ping_req (field 16).
|
|
403
|
+
*/
|
|
404
|
+
private sendPing;
|
|
405
|
+
/** Start sending pings at pingIntervalS and watching for pong timeout. */
|
|
406
|
+
private startPingInterval;
|
|
407
|
+
/** Stop ping interval + timeout timers. */
|
|
408
|
+
private stopPingInterval;
|
|
409
|
+
/** Reset the pong-timeout timer. Called when we receive a pong. */
|
|
410
|
+
private resetPingTimeout;
|
|
389
411
|
}
|
|
390
412
|
|
|
391
413
|
/**
|
|
@@ -423,6 +445,8 @@ declare class RTCEngine extends TypedEmitter<EngineEvents> {
|
|
|
423
445
|
private pendingCandidates;
|
|
424
446
|
private joinResponse;
|
|
425
447
|
private publishWaiters;
|
|
448
|
+
private _negotiateResolve;
|
|
449
|
+
private _publisherConnectedResolve;
|
|
426
450
|
get isConnected(): boolean;
|
|
427
451
|
get publisherPC(): RTCPeerConnection | null;
|
|
428
452
|
get subscriberPC(): RTCPeerConnection | null;
|
|
@@ -430,12 +454,20 @@ declare class RTCEngine extends TypedEmitter<EngineEvents> {
|
|
|
430
454
|
get lossyDataChannel(): RTCDataChannel | null;
|
|
431
455
|
constructor();
|
|
432
456
|
connect(url: string, token: string, options?: EngineOptions): Promise<JoinResponse>;
|
|
457
|
+
/**
|
|
458
|
+
* Wait for the primary PeerConnection ICE to reach "connected".
|
|
459
|
+
* When subscriberPrimary=true the subscriber PC is primary;
|
|
460
|
+
* otherwise the publisher PC is primary.
|
|
461
|
+
*/
|
|
462
|
+
private waitForPrimaryConnected;
|
|
433
463
|
addTransceiver(track: MediaStreamTrack): Promise<RTCRtpTransceiver>;
|
|
434
464
|
requestPublishTrack(cid: string, name: string, type: TrackType, source: TrackSource, options?: {
|
|
435
465
|
disableDtx?: boolean;
|
|
436
466
|
muted?: boolean;
|
|
437
467
|
}): Promise<TrackPublishedResponse>;
|
|
438
468
|
negotiate(): Promise<void>;
|
|
469
|
+
/** Wait for publisher ICE to reach connected state (DTLS+SRTP ready). */
|
|
470
|
+
waitForPublisherConnected(timeoutMs?: number): Promise<void>;
|
|
439
471
|
sendData(data: Uint8Array, kind: 'reliable' | 'lossy'): void;
|
|
440
472
|
disconnect(): Promise<void>;
|
|
441
473
|
private buildIceServers;
|
|
@@ -518,6 +550,8 @@ declare class AudioSource {
|
|
|
518
550
|
flush(): void;
|
|
519
551
|
/** Release encoder resources */
|
|
520
552
|
destroy(): void;
|
|
553
|
+
private _rtpCount;
|
|
554
|
+
private _warnedNoCallback;
|
|
521
555
|
private encodeAndSend;
|
|
522
556
|
}
|
|
523
557
|
|
|
@@ -573,6 +607,8 @@ declare class TrackPublication extends TypedEmitter<TrackPublicationEvents> {
|
|
|
573
607
|
source: TrackSource;
|
|
574
608
|
mimeType: string;
|
|
575
609
|
muted: boolean;
|
|
610
|
+
/** Media ID assigned by SFU — used to match WebRTC transceivers to publications */
|
|
611
|
+
mid: string;
|
|
576
612
|
constructor(info: TrackInfo);
|
|
577
613
|
updateInfo(info: TrackInfo): void;
|
|
578
614
|
}
|
|
@@ -773,6 +809,8 @@ declare class Room extends TypedEmitter<RoomEvents> {
|
|
|
773
809
|
private _isConnected;
|
|
774
810
|
private activeSpeakers;
|
|
775
811
|
private roomInfo;
|
|
812
|
+
/** Identity-prefixed logger for debugging multi-Room scenarios */
|
|
813
|
+
private log;
|
|
776
814
|
constructor();
|
|
777
815
|
get isConnected(): boolean;
|
|
778
816
|
/**
|
|
@@ -795,7 +833,18 @@ declare class Room extends TypedEmitter<RoomEvents> {
|
|
|
795
833
|
private setupEngineHandlers;
|
|
796
834
|
private setupSignalHandlers;
|
|
797
835
|
private handleParticipantUpdate;
|
|
836
|
+
/** Pending tracks waiting to be matched to a participant publication */
|
|
837
|
+
private pendingTracks;
|
|
798
838
|
private handleRemoteTrack;
|
|
839
|
+
/**
|
|
840
|
+
* Match a media track to a participant publication.
|
|
841
|
+
* Strategy:
|
|
842
|
+
* 1. Try matching by mid (SFU assigns mid in TrackInfo)
|
|
843
|
+
* 2. Fall back to first unassigned audio publication (for SFUs that don't set mid)
|
|
844
|
+
*/
|
|
845
|
+
private matchTrack;
|
|
846
|
+
/** Try to match any pending tracks after participant updates arrive */
|
|
847
|
+
private flushPendingTracks;
|
|
799
848
|
private handleDataMessage;
|
|
800
849
|
private handleSpeakersChanged;
|
|
801
850
|
private getOrCreateParticipant;
|