colyseus library

Colyseus client SDK for Flutter, over the native C SDK via dart:ffi.

Classes

ArraySchema<T>
A typed view over a decoded ArraySchema; see MapSchema for the rules.
CollectionCallbacks<V, K>
Typed StateCallbacks.onAdd / StateCallbacks.onRemove over one collection field. K is String for maps and int for arrays.
Colyseus
Process-wide runtime control.
ColyseusAuth
The auth surface of a ColyseusClient, reached as client.auth.
ColyseusAuthData
The token and user record a successful auth call returns.
ColyseusClient
A Colyseus multiplayer client.
ColyseusError
Error from a Colyseus room or client operation.
ColyseusHttp
The HTTP surface of a ColyseusClient, reached as client.http.
ColyseusHttpResponse
One HTTP reply.
ColyseusRoom
Represents a room connection to a Colyseus server.
Drift
Prediction-error telemetry.
EventChannel
A channel of optimistic events of one logical kind.
FieldOptions
Per-field smoothing settings. Zero values take the reference defaults.
InputHandle
A typed input channel to the server.
InputOptions
Configuration for ColyseusRoom.input. First call wins — the handle is created lazily and later calls return the existing one.
MapSchema<T>
A typed view over a decoded MapSchema.
Predict
Smoothing and prediction for a room's entities.
PropertyCallbacks<V>
Typed StateCallbacks.listen over one scalar field.
Reconciler
Server-reconciled prediction for the entity this client controls.
RefCallbacks<R extends SchemaRef>
Typed StateCallbacks.listen over one child-instance field.
RoomClock
Clock sync and RTT estimation for a room.
SchemaArray
A decoded ArraySchema, indexed by position.
SchemaCache
Wrapper identity for typed schema access.
SchemaCallbacksOf<T extends SchemaRef>
The typed callback surface for one schema instance.
SchemaInstance
A decoded schema instance.
SchemaMap
A decoded MapSchema, keyed by string.
SchemaRef
Base class for generated typed schema façades.
SchemaView
Fast scalar access to one schema instance.
SimOptions
Configuration for Predict.sim.
SimPart
One entity in a composite simulation.
SimWorld
The world handed to a composite step.
SpawnEntry
One predicted or confirmed entity in a Spawns store.
Spawns
Optimistically spawned entities, reconciled with the server.
SpawnsOptions
Configuration for a Spawns store.
StateCallbacks
Registers schema-state callbacks against one room's decoder.
StepContext
The per-step context handed to a ReconcilerStep.

Enums

ColyseusEventType
Event types from the native layer.
DriftStatus
How well the client's prediction is tracking the server.
InputMode
How an input channel reaches the server.
MessageValueType
Message value types from the native msgpack reader.
PredictMode
How a tracked field follows the server stream.
SchemaFieldType
Schema field types.

Functions

classifyDrift(Drift drift, {double tolerance = 0}) DriftStatus
Classifies drift against a world-space tolerance.
createSimReconciler({required Predict predict, required InputHandle input, required SimStep step, required SimOptions options}) Reconciler
Builds a composite reconciler over several entities at once.
getStateCallbacks(ColyseusRoom room) StateCallbacks
The schema-callbacks surface for room.
msgpackDecode(Uint8List bytes) Object?
Decodes a MessagePack payload into Dart values.

Typedefs

ReckonStep = void Function(SchemaView state, double dt, double elapsedMs)
Advances a dead-reckoned entity in place.
ReconcilerStep = void Function(StepContext ctx, SchemaView state, SchemaView command)
Applies one input to the predicted state.
SimStep = void Function(StepContext ctx, SimWorld world, SchemaView command)
Advances a whole world of parts by one input.

Exceptions / Errors

ColyseusAuthException
An auth call that the server rejected, or that never reached it.
ColyseusHttpException
A non-2xx reply, or a transport failure before one arrived.
MsgpackFormatException
Thrown when a payload isn't valid MessagePack.