@@ -293,20 +293,22 @@ async def perform_rpc(
293293 def register_rpc_method (
294294 self ,
295295 method_name : str ,
296- handler : Optional [Callable [[RpcInvocationData ], Union [Awaitable [str ], str ]]] = None ,
296+ handler : Optional [
297+ Callable [[RpcInvocationData ], Union [Awaitable [str ], str ]]
298+ ] = None ,
297299 ) -> Union [None , Callable ]:
298300 """
299301 Establishes the participant as a receiver for calls of the specified RPC method.
300302 Can be used either as a decorator or a regular method.
301-
303+
302304 The handler will recieve one argument of type `RpcInvocationData` and should return a string response which will be forwarded back to the caller.
303-
305+
304306 The handler may be synchronous or asynchronous.
305307
306308 If unable to respond within `response_timeout`, the caller will hang up and receive an error on their side.
307309
308310 You may raise errors of type `RpcError` in the handler, and they will be forwarded to the caller.
309-
311+
310312 Other errors raised in your handler will be caught and forwarded to the caller as "1500 Application Error".
311313
312314 Args:
@@ -322,7 +324,7 @@ def register_rpc_method(
322324 async def greet_handler(data: RpcInvocationData) -> str:
323325 print(f"Received greeting from {data.caller_identity}: {data.payload}")
324326 return f"Hello, {data.caller_identity}!"
325-
327+
326328 # As a regular method:
327329 async def greet_handler(data: RpcInvocationData) -> str:
328330 print(f"Received greeting from {data.caller_identity}: {data.payload}")
@@ -382,7 +384,9 @@ async def _handle_rpc_method_invocation(
382384 else :
383385 try :
384386 if asyncio .iscoroutinefunction (handler ):
385- async_handler = cast (Callable [[RpcInvocationData ], Awaitable [str ]], handler )
387+ async_handler = cast (
388+ Callable [[RpcInvocationData ], Awaitable [str ]], handler
389+ )
386390
387391 async def run_handler ():
388392 try :
0 commit comments