-
Notifications
You must be signed in to change notification settings - Fork 10
RPC features #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC features #13
Conversation
ladvoc
left a comment
There was a problem hiding this 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() != |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with removing it.
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)