Experimental
Optional
destinationIdentities: string[]Optional
senderIdentity: stringInternal
Parameters for initiating the RPC call, see PerformRpcParams
A promise that resolves with the response payload or rejects with an error.
Establishes the participant as a receiver for calls of the specified RPC method. Will overwrite any existing callback for the same method.
The name of the indicated RPC method
Will be invoked when an RPC request for this method is received
A promise that resolves when the method is successfully registered
room.localParticipant?.registerRpcMethod(
'greet',
async (data: RpcInvocationData) => {
console.log(`Received greeting from ${data.callerIdentity}: ${data.payload}`);
return `Hello, ${data.callerIdentity}!`;
}
);
See RpcInvocationData for more details on invocation params.
The handler should return a Promise that resolves to a string.
If unable to respond within responseTimeout
, the request will result in an error on the caller's side.
You may throw errors of type RpcError
with a string message
in the handler,
and they will be received on the caller's side with the message intact.
Other errors thrown in your handler will not be transmitted as-is, and will instead arrive to the caller as 1500
("Application Error").
Sends a chat message to participants in the room
The text content of the chat message.
Optional
destinationIdentities: string[]An optional array of recipient identities to whom the message will be sent. If omitted, the message is broadcast to all participants.
Optional
senderIdentity: stringAn optional identity of the sender. If omitted, the default sender identity is used.
Sends a file provided as PathLike to specified recipients
Optional
options: ByteStreamOptionsOptional
options: {Optional
options: {Returns a StreamWriter
instance that allows to write individual chunks of text to a stream.
Well suited for TTS and/or streaming LLM output. If you want to simply send a text then use sendText() instead
Optional
options: {Optional
stopOnUnpublish: booleanUnregisters a previously registered RPC method.
The name of the RPC method to unregister
Initiate an RPC call to a remote participant.