Synclets logoSynclets

DurableObjectBrokerTransportOptions

The DurableObjectBrokerTransportOptions type describes the options for creating a broker transport for Cloudflare Durable Objects.

(
  {
    path?: string | null;
    brokerPaths?: RegExp;
  } &
  DurableObjectTransportOptions
)
TypeDescription
path?string | null

The path that this Durable Object will participate in as a synclet. Set to null for broker-only mode where the Durable Object only routes messages between clients without participating itself. Set to a string to have the Durable Object participate in that specific path.

brokerPaths?RegExp

A regular expression pattern that determines which paths this broker will accept and route. Clients connecting to paths that don't match this pattern will be rejected. Defaults to accept all paths.

Example

const transport = createDurableObjectBrokerTransport({
  durableObject: this,
  path: null, // Broker-only mode
  brokerPaths: /room[0-9]+/, // Only broker paths matching this pattern
});

Since

v0.0.7