method WorkersBroker.prototype.request
WorkersBroker.prototype.request<TReq, TRes>(
topic: string,
message: TReq,
options?: RequestOptions
): Promise<TRes>

Sends a request and awaits its single correlated reply.

Type Parameters

TReq

The request payload type

TRes

The reply payload type

Parameters

topic: string

Destination topic a responder is listening on

message: TReq

The request payload

optional
options: RequestOptions

Reply timeout behavior

Return Type

Promise<TRes>

The reply payload

Throws

CloudflareUnsupportedError

When the messaging.rpc arm is absent

CloudflareRequestTimeoutError

When no reply arrives in time

CloudflareRemoteHandlerError

When the responder threw

Usage

import { WorkersBroker } from "cloudflare-plugin/src/index.ts";