Individual timeouts - Xenoage/RpcLib GitHub Wiki
By default, there is a timeout for a RPC command of 30 seconds. Individual timeouts may be used, e.g. for commands which make only sense if they can be executed within a short period like one or two seconds. For this, simply annotate the function in your interface with the RpcOptionsAttribute
, using the TimeoutMs
parameter. Here is an example, using a service for saving log messages on the remote peer:
interface IRemoteLogger : IRpcFunctions {
[RpcOptions(TimeoutMs = 100)]
Task SaveMessage(string message);
}
You can also change the default timeout for all functions which are not annotated in this way, by providing a value in the RpcMain.InitRpcServer
or RpcMain.InitRpcClient
method.