bynk.test.ws_lifecycle_by
Error A case's svc.message(tc, frame) or svc.close(tc) on a from websocket service carries a by clause; the connection's principal is given once, at open, and carried from there.
A WebSocket connection's principal is given once, at open, and the connection carries it from there, as the platform recovers it from the socket. So message and close take no by: a case that named one could present a principal production never sees. Drop the by. To act as another principal, open a new TestConnection.
Example
let tc = TestConnection[Frame]()let _ <- Gateway.open(tc, RoomId.unsafe("r")) by Member(UserId.unsafe("ann"))let _ <- Gateway.message(tc, Frame { text: "hi" }) by Member(UserId.unsafe("ann")) // ✗ given at `open`let _ <- Gateway.message(tc, Frame { text: "hi" }) // ✓In the Book
See also
- The grammar rule it governs:
case. - Every code in its category, Tests, on the diagnostic index.
bynk explain bynk.test.ws_lifecycle_byshows the same from the installed toolchain, without a network.