Skip to content

Commit a4ed27d

Browse files
committed
refactor: reorganize some code / cosmetic changes
1 parent 0dd63ca commit a4ed27d

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/room/rpc/client/RpcClientManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export default class RpcClientManager extends (EventEmitter as new () => TypedEm
6262
method,
6363
payload,
6464
responseTimeout: responseTimeoutMs = 15000,
65-
}: PerformRpcParams): Promise<[string /* id */, Promise<string>]> {
65+
}: PerformRpcParams): Promise<[id: string, completionPromise: Promise<string>]> {
6666
const maxRoundTripLatencyMs = 7000;
6767
const minEffectiveTimeoutMs = maxRoundTripLatencyMs + 1000;
6868

6969
const remoteClientProtocol = this.getRemoteParticipantClientProtocol(destinationIdentity);
7070
const payloadBytes = byteLength(payload);
7171

72-
// Only enforce the legacy size limit when compression is not available
72+
// Only enforce the legacy size limit when on rpc v1
7373
if (payloadBytes > MAX_V1_PAYLOAD_BYTES && remoteClientProtocol < 1) {
7474
throw RpcError.builtIn('REQUEST_PAYLOAD_TOO_LARGE');
7575
}

src/room/rpc/server/RpcServerManager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default class RpcServerManager extends (EventEmitter as new () => TypedEm
6060
/**
6161
* Handle an incoming RPCRequest message containing a payload.
6262
* This handles "version 1" of rpc requests.
63+
* @internal
6364
*/
6465
async handleIncomingRpcRequest(callerIdentity: string, rpcRequest: RpcRequest) {
6566
this.publishRpcAck(callerIdentity, rpcRequest.id);
@@ -116,6 +117,7 @@ export default class RpcServerManager extends (EventEmitter as new () => TypedEm
116117
/**
117118
* Handle an incoming data stream containing a RPC request payload.
118119
* This handles "version 2" of rpc requests.
120+
* @internal
119121
*/
120122
async handleIncomingDataStream(
121123
reader: TextStreamReader,

src/room/rpc/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ export const MAX_V1_PAYLOAD_BYTES = 15360; // 15 KB
150150
*/
151151
export const RPC_REQUEST_DATA_STREAM_TOPIC = 'lk.rpc_request';
152152

153+
/**
154+
* Topic used for v2 RPC response data streams.
155+
* @internal
156+
*/
157+
export const RPC_RESPONSE_DATA_STREAM_TOPIC = 'lk.rpc_response';
158+
153159
/** @internal */
154160
export const RPC_REQUEST_ID_ATTR = 'lk.rpc_request_id';
155161

@@ -162,12 +168,6 @@ export const RPC_REQUEST_RESPONSE_TIMEOUT_MS_ATTR = 'lk.rpc_request_response_tim
162168
/** @internal */
163169
export const RPC_REQUEST_VERSION_ATTR = 'lk.rpc_request_version';
164170

165-
/**
166-
* Topic used for v2 RPC request data streams.
167-
* @internal
168-
*/
169-
export const RPC_RESPONSE_DATA_STREAM_TOPIC = 'lk.rpc_response';
170-
171171
/**
172172
* @internal
173173
*/

0 commit comments

Comments
 (0)