11// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
22//
33// SPDX-License-Identifier: Apache-2.0
4- import {
5- DataPacket ,
6- DataPacket_Kind ,
7- RpcRequest ,
8- } from '@livekit/protocol' ;
4+ import { DataPacket , DataPacket_Kind , RpcRequest } from '@livekit/protocol' ;
95import { type StructuredLogger } from '../../logger' ;
6+ import { CLIENT_PROTOCOL_GZIP_RPC } from '../../version' ;
107import type RTCEngine from '../RTCEngine' ;
8+ import type { ByteStreamReader } from '../data-stream/incoming/StreamReader' ;
119import type OutgoingDataStreamManager from '../data-stream/outgoing/OutgoingDataStreamManager' ;
10+ import { EngineEvent } from '../events' ;
1211import type Participant from '../participant/Participant' ;
1312import { Future , compareVersions } from '../utils' ;
14- import type { ByteStreamReader } from '../data-stream/incoming/StreamReader' ;
1513import {
1614 DATA_STREAM_MIN_BYTES ,
1715 MAX_LEGACY_PAYLOAD_BYTES ,
@@ -27,8 +25,6 @@ import {
2725 gzipDecompress ,
2826 gzipDecompressFromReader ,
2927} from './utils' ;
30- import { CLIENT_PROTOCOL_GZIP_RPC } from '../../version' ;
31- import { EngineEvent } from '../events' ;
3228
3329/**
3430 * Manages the client (caller) side of RPC: sending requests, tracking pending
@@ -49,7 +45,7 @@ export default class RpcClientManager {
4945 private pendingResponses = new Map <
5046 string /* request id */ ,
5147 {
52- completionFuture : Future < string , RpcError > ,
48+ completionFuture : Future < string , RpcError > ;
5349 participantIdentity : string ;
5450 }
5551 > ( ) ;
@@ -276,7 +272,9 @@ export default class RpcClientManager {
276272 }
277273
278274 default : {
279- this . log . warn ( `Error handling RPC response data packet: unknown rpcResponse.value.case found (${ rpcResponse . value . case } )` ) ;
275+ this . log . warn (
276+ `Error handling RPC response data packet: unknown rpcResponse.value.case found (${ rpcResponse . value . case } )` ,
277+ ) ;
280278 return false ;
281279 }
282280 }
@@ -303,10 +301,7 @@ export default class RpcClientManager {
303301 * Handle an incoming byte stream containing an RPC response payload.
304302 * Decompresses the stream and resolves/rejects the pending data stream future.
305303 */
306- async handleIncomingDataStream (
307- reader : ByteStreamReader ,
308- responseId : string ,
309- ) {
304+ async handleIncomingDataStream ( reader : ByteStreamReader , responseId : string ) {
310305 let decompressedPayload : string ;
311306 try {
312307 decompressedPayload = await gzipDecompressFromReader ( reader ) ;
@@ -347,7 +342,8 @@ export default class RpcClientManager {
347342 }
348343 }
349344
350- for ( const [ id , { participantIdentity : pendingIdentity , completionFuture } ] of this . pendingResponses ) {
345+ for ( const [ id , { participantIdentity : pendingIdentity , completionFuture } ] of this
346+ . pendingResponses ) {
351347 if ( pendingIdentity === participantIdentity ) {
352348 completionFuture . reject ?.( RpcError . builtIn ( 'RECIPIENT_DISCONNECTED' ) ) ;
353349 this . pendingResponses . delete ( id ) ;
0 commit comments