Skip to content
Playground(another site)

bynk.service.websocket_header

Error The from websocket header is malformed — it binds frame types as websocket(in: <type>, out: <type>) (real-time track slice 3).

A WebSocket service names its two frame types in the header, from websocket(in: ClientFrame, out: ServerFrame): in is what the server decodes from the client and out is what it sends back. The labels are fixed and in that order, so the compiler can tell the two apart without guessing from the handlers. Spell them in: then out:.

Example

service gateway from websocket(input: Frame, out: Frame) { // ✗ the first label must be `in`
on open (room: RoomId) -> Effect[()] by user: Member { … }
}
service gateway from websocket(in: Frame, out: Frame) { // ✓
on open (room: RoomId) -> Effect[()] by user: Member { … }
}

In the Book

See also

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