GameSession

open class GameSession

A running game session: the consensus node plus any named application channels riding the same fabric.

Returned by gameNode, gameHost, and gameJoin. Drive the game through node (typically wrapped in a TurnSequencer); ride extra application traffic — chat, cursors, voice signalling — over appChannel.

App channels share the consensus fabric. Each appChannel is a NamedMux view nested under a reserved internal channel, so application frames travel over the very same Seam as Raft without a second connection and without violating the ADR-034 single-collection contract (the session owns the sole collector). The app wire-layout is identical across all three bootstrap paths. The application owns the entire appChannel name namespace — there are no reserved names, because internal channels never live in it.

Calling appChannel subscribes that name before returning. The view buffers arriving frames until the application collects its incoming flow, including replies to an immediate send. Frames arriving before the peer creates that named channel are not replayed (replay = 0).

Inheritors

Properties

Link copied to clipboard

Host-verified principals of currently-linked peers, keyed by the PeerId each was verified against at admission — the hosted-path analogue of the relay path's Member.principal.

Link copied to clipboard

Functions

Link copied to clipboard
fun appChannel(name: String): Seam

Returns the application Seam for the channel named name, idempotent per name.

Link copied to clipboard
open suspend fun close(reason: CloseReason = CloseReason.Normal)

Local teardown: stops the consensus node's loops, then closes the underlying fabric. Idempotent — a second call is a no-op.

Link copied to clipboard
fun leave()

Signals a voluntary departure from the game session.

Link copied to clipboard

The host-verified Principal of peer, or null if that peer is not currently linked with an attestation. A convenience snapshot of attestedPrincipals.