Skip to content

Conversation

@xianshijing-lk
Copy link
Collaborator

This PR implement the RPC features and a SimpleRpc example

To run the SimpleRpc example, you will need to

run local dev server

livekit-server --dev

generate tokens for caller, greeting and math-genius

lk token create -r test -i caller --join --valid-for 99999h --dev --room=robot
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=robot
lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=robot

build the example

./build.sh debug

run the example in 3 terminals:

./build/examples/SimpleRpc ws://127.0.0.1:7880 $TOKEN --role=caller (--role=greeter, --role=math-genius)

Copy link

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

src/room.cpp Outdated
return;
}
auto local_handle = local_participant_->ffiHandleId();
if (local_handle == 0 || rpc.local_participant_handle() !=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Maybe defining a constant (i.e., FFI_HANDLE_INVALID) would clarify what this check does?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, I can use INVALID_HANDLE

src/room.cpp Outdated
// First, handle RPC method invocations (not part of RoomEvent).
if (event.message_case() == FfiEvent::kRpcMethodInvocation) {
const auto &rpc = event.rpc_method_invocation();
std::cout << "kRpcMethodInvocation \n";
Copy link

@ladvoc ladvoc Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Should the print be removed?

Copy link
Collaborator Author

@xianshijing-lk xianshijing-lk Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with removing it.

@xianshijing-lk xianshijing-lk merged commit 96e7643 into main Dec 9, 2025
5 checks passed
@xianshijing-lk xianshijing-lk deleted the sxian/CLT-2338/implement_rpc_feature branch December 9, 2025 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants