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 property specifies the WebSocket path to listen on such that the synclet can itself participate in the brokered communication. Leave as the default (null) for broker-only mode where the synclet only routes messages between clients without participating itself.

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.0