Skip to content
Playground(another site)

bynk.types.held_at_boundary

Error A held value (Connection[F]) appears in a serialisable or boundary position — a held resource is built and disposed in place, never persisted or sent across a boundary (§2.9, real-time track slice 2).

A Connection is a held resource, built and disposed of in place, so it is never stored or sent: it cannot be a record, sum or event field, or part of a service or agent handler signature. An agent may keep one in its own state, as Cell[Option[Connection[F]]] or Map[K, Connection[F]]. Keep it there, and pass what you need from it, not the connection.

Example

type Session = {
conn: Connection[Frame], // ✗ a held resource is not a field
}
agent Room {
key id: String
store conns: Map[String, Connection[Frame]] // ✓ held in agent state
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.held_at_boundary shows the same from the installed toolchain, without a network.