Skip to content
Playground(another site)

bynk.ws.lifecycle_by_mismatch

Error A WebSocket on message/on close handler's by clause does not name the same actor(s) as on open's — the connection's principal is verified once, at on open, and carried for its life, so the lifecycle handlers must be the same single actor or the same actor-sum members (binder names may differ).

The connection's principal is verified once, by on open's by, and carried for the life of the connection; on message and on close read it and never verify again. So their by must name the same actor as on open's, or the same members of an actor sum. The binder names may differ. Change the lifecycle handler's by to match on open.

Example

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

In the Book

See also

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