Skip to main content

Function: sendDownstream()

sendDownstream(clientIds, doInstance, payload): Promise<void>

Defined in: lumenize-rpc-do.ts:49

Send a downstream message to specific clients via their WebSocket connections.

Messages are sent with type '__downstream' and support full type serialization via @lumenize/structured-clone (Errors, Web API objects, special numbers, etc.).

This is a fire-and-forget operation - messages are sent immediately to connected clients. If a client is disconnected, the message is not queued or retried. Use application-layer catchup patterns (e.g., fetching missed messages by ID) for reliability.

Parameters​

clientIds​

Client ID(s) to send the message to (string or array of strings)

string | string[]

doInstance​

any

The Durable Object instance (pass this)

payload​

any

The payload to send (supports all serializable types)

Returns​

Promise<void>

See​

Downstream Messaging Guide - Complete examples with authentication