acceptable-psychiatrist-80817
08/11/2025, 1:09 PMtall-airline-16756
08/11/2025, 1:10 PMtall-airline-16756
08/11/2025, 1:10 PMroom.localParticipant?.registerRpcMethod(
'greet',
async (data: RpcInvocationData) => {
console.log(`Received greeting from ${data.callerIdentity}: ${data.payload}`);
return `Hello, ${data.callerIdentity}!`;
}
);
2. Perform the RPC call from the backend (caller participant):
try {
const response = await room.localParticipant!.performRpc({
destinationIdentity: 'recipient-identity',
method: 'greet',
payload: 'Hello from RPC!',
});
console.log('RPC response:', response);
} catch (error) {
console.error('RPC call failed:', error);
}
Just a few things to keep in mind:
• Make sure the method name is exactly the same when you register it and when you call it.
• Sometimes RPC calls might fail because of timeouts, connection hiccups, or invalid methods — so having good error handling is super helpful.
• Your payloads can be strings up to 15KiB, and you’re free to use JSON or whatever format fits your needs.
• The default timeout for responses is 10 seconds, but you can tweak that if you need to.
If you’re still running into issues, double-check that the method name and destination identity are spot on, and confirm that the frontend participant is properly connected to the room. You’ve got this!acceptable-psychiatrist-80817
08/11/2025, 2:33 PMtall-airline-16756
08/11/2025, 2:34 PMregisterRpcMethod
before any RPC calls happen. For example:
activeRoom.localParticipant?.registerRpcMethod(
"changeChart",
async (data) => {
console.log("client.changeChart RPC payload:", data.payload);
dispatch(setSymbol(data.payload));
return "success";
}
);
2. Check Method Name: Double-check that the method name you use in performRpc
exactly matches the registered method name, including capitalization.
3. Verify Participant Connection: Make sure the destination participant is connected to the room and that the method registration happens after this connection is established.
4. Debugging Tips:
• Try logging the list of registered methods on the destination participant to see if your method shows up.
• Keep SDK versions consistent across participants to avoid any compatibility hiccups.
• Look out for any typos or case mismatches in the method name.
If you’re still stuck, it’d be great to double-check:
• That the method registration happens after the participant joins the room.
• That the destination participant is correctly identified in the performRpc
call.
Hope this helps! Feel free to reach out if you want to chat more about this.acceptable-psychiatrist-80817
08/11/2025, 2:44 PMtall-airline-16756
08/11/2025, 2:44 PMactiveRoom
object on the frontend fully set up and connected to the room before you call registerRpcMethod
?
• On the backend side, are you sure that the participant.identity
matches the identity of the frontend participant where the method is registered?
• Do you see any errors or logs on the frontend when the backend tries to call the RPC method?
Getting these details will really help us figure out what’s going on.acceptable-psychiatrist-80817
08/11/2025, 2:44 PMtall-airline-16756
08/11/2025, 2:45 PMactiveRoom
is fully initialized and connected to the room before you call registerRpcMethod
. If activeRoom
is undefined or not connected yet, the method registration won’t work as expected.
• Double-check that the method name "changeChart"
exactly matches (including case) the one used on the backend.
• Take a peek at the browser console to see if there are any errors or logs when the backend tries to call the RPC method.
Backend:
• Ensure that participant.identity
matches the identity of the frontend participant where the method is registered. If it doesn’t, the RPC call won’t go through.
• Verify that room.local_participant
is properly initialized and connected before you call perform_rpc
.
• Check your logs for any errors or exceptions during the perform_rpc
call.
If you’ve already checked these and the problem is still there, just let me know! We can dig a little deeper together and figure it out.acceptable-psychiatrist-80817
08/11/2025, 3:01 PMacceptable-psychiatrist-80817
08/11/2025, 3:01 PMtall-airline-16756
08/11/2025, 3:02 PMrpcHandlers
map does include the changeChart
method, which means it’s successfully registered on the frontend.
That said, the state
of the room is showing as "disconnected"
. This might be why the backend isn’t able to call the RPC method. For everything to work smoothly, the room needs to be in a "connected"
state.
Could you please double-check a few things for me?
• Make sure the frontend participant is connected to the room when the backend tries to call the RPC method.
• Look out for any disconnection events or errors in the frontend logs that might explain why the room is "disconnected"
.
• Verify that the backend is using the correct destination_identity
that matches the frontend participant’s identity.
Feel free to reach out if you’d like me to help further after you’ve checked these points!acceptable-psychiatrist-80817
08/11/2025, 3:04 PMtall-airline-16756
08/11/2025, 3:05 PMchangeChart
is properly registered on the frontend using registerRpcMethod
.
• Double-check that there aren’t any duplicate registrations or errors during the registration process.
2. Check RPC Invocation:
• Confirm the backend is calling perform_rpc
with the exact method name changeChart
(remember, it’s case-sensitive).
• Verify that the destination_identity
matches the identity of the frontend participant where the method is registered.
3. Network and Payload:
• Make sure there aren’t any network issues or firewalls blocking the RPC traffic.
• Check that the payload size stays within the 15KB limit.
4. Error Handling:
• Take a look at any errors or exceptions logged on both frontend and backend to help pinpoint what’s going on.
• Ensure the RPC handler on the frontend is processing requests within the set responseTimeout
.
If you’re still running into trouble, could you please share:
• The exact error message or what you’re seeing happening.
• Confirmation that the method names match exactly between registration and invocation.
• Any relevant logs or network traces from both frontend and backend.acceptable-psychiatrist-80817
08/11/2025, 5:20 PMtall-airline-16756
08/11/2025, 5:20 PMperform_rpc
needs to be the same as the one you registered on the frontend with registerRpcMethod
. Since method names are case-sensitive, even a tiny difference in capitalization or spelling can cause issues.
Could you double-check that the method name "changeChart"
is exactly the same on both sides? Once that’s sorted, your RPC call should work smoothly. Let me know if you need any help with this!