RoomAuthorizer

fun interface RoomAuthorizer

Server-side authorization policy for room membership.

Invoked once per connection per room tag when a connection first emits a frame on that channel (lazy-on-first-frame registration). A returning false means the connection is never added to the room's fanout or Seam.peers — structural rejection, not a runtime filter. The rejected connection is structurally absent from the room: a cross-room leak stays unrepresentable.

Required — non-nullable, no default

Per the "optional ≠ tuning" rule, this parameter is required wherever it is wired: absent or nullable would silently disable the authorization gate. Supply AllowAll in tests and benchmarks; supply a real policy in production.

Example

val authorizer = RoomAuthorizer { peer, tag ->
sessionStore.isAdmitted(peer, tag)
}
val serverLoom = MuxServerLoom(source, scope, PeerId("server"), authorizer = authorizer)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun authorize(peerId: PeerId, channelName: String): Boolean

Return true to admit peerId into the room identified by channelName, false to reject (structural exclusion — the connection is never added to the fanout).