Home > paper-cups > RpcClient > sendAndWait
Execute a message exchange and *wait* for the response. ***This will block the main thread***.
Signature:
sendAndWait<ReturnData = any, SendData = any>(opcode: string, payload?: SendData, timeout?: number): Promise<MaybeProps<ReturnData>>;
Parameter | Type | Description |
---|---|---|
opcode | string | An opcode indicating the procedure being executed. |
payload | SendData | The request payload. |
timeout | number | Duration in milliseconds after which the wait period times out unless a message is received. For an indefinite wait-period, set this to -1 (not recommended). |
Returns:
Promise<MaybeProps<ReturnData>>