freezing-jelly-85538
07/25/2025, 3:46 PMtall-airline-16756
07/25/2025, 3:46 PMtall-airline-16756
07/25/2025, 3:47 PMregisterRpcMethod() and unregisterRpcMethod(). For example:`room.registerRpcMethod('echo', (RpcInvocationData data) async {
return 'echo: => ${data.callerIdentity} ${data.payload}';
});`
• Method Invocation: You can invoke RPC methods on remote participants using performRpc(). For example:`var response = await room.localParticipant?.performRpc(PerformRpcParams(
destinationIdentity: room.localParticipant!.identity,
method: 'echo',
payload: 'hello',
));`
• Core RPC Types: The SDK includes dedicated types for RPC operations, such as:
◦ PerformRpcParams for method invocation parameters
◦ RpcInvocationData for incoming RPC request data
◦ RpcError for error handling
◦ RpcRequestHandler typedef for handler functions
• Error Handling: The SDK supports error handling with predefined error codes like unsupportedMethod, requestPayloadTooLarge, responseTimeout, and applicationError.
• Payload Limits: RPC requests and responses have a maximum payload size of 15 KB (15,360 bytes).
Additionally, there is a complete Flutter RPC demo application available in the LiveKit examples repository for reference.
Sources: lib/src/core/room.dart | packages/rpc-demo/android/app/src/main/kotlin/io/livekit/example/rpc/flutte...