Home > paper-cups > RpcClient > listenAndWait
Wait for the next message of a given opcode
. ***This will block the main thread***.
Signature:
listenAndWait<ReturnData = any>(opcode: string, timeout?: number): Promise<MaybeProps<ReturnData>>;
Parameter | Type | Description |
---|---|---|
opcode | string | An opcode indicating the procedure being executed. |
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>>