Skip to content

Commit 0a6be2d

Browse files
committed
type check
1 parent ddf8f8e commit 0a6be2d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

livekit-rtc/livekit/rtc/participant.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ async def greet_handler(data: RpcInvocationData) -> str:
374374
room = self.room
375375
if room is not None:
376376
return room.register_rpc_method(method_name, handler)
377+
return None
377378

378379
def unregister_rpc_method(self, method: str) -> None:
379380
"""

livekit-rtc/livekit/rtc/room.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ async def greet_handler(data: RpcInvocationData) -> str:
497497
"""
498498

499499
def register(handler_func):
500+
if self._ffi_handle is None:
501+
raise Exception("cannot register RPC method before room is connected")
500502
self._rpc_handlers[method_name] = handler_func
501503
req = proto_ffi.FfiRequest()
502504
req.register_rpc_method.room_handle = self._ffi_handle.handle
@@ -517,6 +519,9 @@ def unregister_rpc_method(self, method: str) -> None:
517519
Args:
518520
method (str): The name of the RPC method to unregister
519521
"""
522+
if self._ffi_handle is None:
523+
raise Exception("cannot unregister RPC method before room is connected")
524+
520525
self._rpc_handlers.pop(method, None)
521526

522527
req = proto_ffi.FfiRequest()

0 commit comments

Comments
 (0)