Room class final
One fixed-tick simulation, its peers, and its replication state. The unit of scaling, one room per isolate/process, state never spans rooms.
Constructors
-
Room({required ReplicaRegistry registry, int tickRate = 30, HostConfig config = const HostConfig(), FutureOr<
bool> verifyToken(Uint8List token)?, void onTick(int tick)?, void onJoin(Session session)?, void onLeave(Session session)?})
Properties
- currentTick → int
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- host ↔ ReplicationHost
-
latefinal
- onJoin → void Function(Session session)?
-
final
- onLeave → void Function(Session session)?
-
final
- onTick → void Function(int tick)?
-
Simulation callback, runs once per fixed tick before replication
flushes.
final
- registry → ReplicaRegistry
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sessions
→ Iterable<
Session> -
no setter
- tickRate → int
-
final
Methods
-
accept(
Stream< WireConnection> acceptor) → void -
Admits every connection produced by
acceptor(a transport server's connections stream). -
admit(
WireConnection connection) → Future< Session?> -
Handshakes
connectioninto this room. -
advance(
double elapsedSeconds) → void -
Feeds
elapsedSecondsinto the fixed-tick loop. -
hydrate(
Uint8List snapshot) → void -
Restores replicas from a
snapshot. Call on a fresh, empty room before start; hydrated replicas spawn always-relevant. -
input(
int peerId, int tick) → Uint8List? -
The authoritative input
peerIdsent fortick, for use inside onTick. SeeReplicationHost.consumeInput. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
snapshot(
) → Uint8List - Serializes the room's replicas and id-allocator state.
-
start(
) → void - Starts the real-time tick pump. Use advance instead to drive time manually (tests, external loops).
-
stop(
) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited