Skip to content
Playground(another site)

bynk.ws.open_given_unsupported

Error A WebSocket on open handler declares given capabilities — unsupported at v1, since on Workers the handler runs inside the connection-hosting Durable Object, which has no composition root to supply them (real-time track slice 3b).

A WebSocket on open cannot declare given capabilities. It only accepts the upgrade and hands the connection to an agent; on Workers it runs inside the Durable Object that holds the connection, where there is no composition root to supply capabilities. Put the work that needs a capability in the agent handler the connection is transferred to, which carries its own given.

Example

service gateway from websocket(in: Frame, out: Frame) {
on open (room: RoomId) -> Effect[()] by user: Member given Clock { … } // ✗ no capabilities on `on open`
}
service gateway from websocket(in: Frame, out: Frame) {
on open (room: RoomId) -> Effect[()] by user: Member { … } // ✓ the agent's handler takes the `given`
}

In the Book

See also

  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.ws.open_given_unsupported shows the same from the installed toolchain, without a network.