Skip to content
Playground(another site)

bynk.service.websocket_open_arity

Error A from websocket service must hold exactly one on open handler (the edge upgrade), and at most one on message (inbound) and one on close (real-time track slice 3/3b-iii).

A WebSocket service has exactly one on open, the handler that accepts the upgrade and receives the connection, and at most one on message and one on close. A service with no on open could never accept a client, and a second of any handler would leave it unclear which one runs. Add the missing on open, or remove the duplicate.

Example

service gateway from websocket(in: Frame, out: Frame) { // ✗ no `on open`
on message (room: RoomId, frame: Frame) -> Effect[()] by user: Member { … }
}
service gateway from websocket(in: Frame, out: Frame) {
on open (room: RoomId) -> Effect[()] by user: Member { … } // ✓
on message (room: RoomId, frame: Frame) -> Effect[()] by user: Member { … }
}

In the Book

See also

  • Every code in its category, Services, on the diagnostic index.
  • bynk explain bynk.service.websocket_open_arity shows the same from the installed toolchain, without a network.