Is there no RPC support on Flutter SDK?
# ask-ai
f
Is there no RPC support on Flutter SDK?
t
Thanks for reaching out, Anish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The LiveKit Flutter SDK does support RPC (Remote Procedure Calls). Here are the key features: • Method Registration: You can register and unregister RPC methods using
registerRpcMethod()
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...