Class CommandsMessage
COMMANDS (0x83): u32 clientTick | varu count ≥ 1 | (varu cmdTypeIdx | u16 seq | fields)*, the client's batch for one rendered frame.
public static class CommandsMessage
- Inheritance
-
CommandsMessage
- Inherited Members
Remarks
Validated whole before anything is delivered (03-wire-protocol § 8: known type → length consumed exactly → decode). The message is decoded once into a checking sink — every type known, every enum value within its names (W13), not a byte left over — and only then decoded again into the caller's sink, so a malformed tail can never deliver the valid commands in front of it. Commands are small and rate-limited; decoding twice costs nothing measurable.
Methods
Read<TSink>(ReadOnlySpan<byte>, CatalogPlan, ref TSink, RealmFrame)
Validates, then decodes, a whole COMMANDS message, type byte included.
public static void Read<TSink>(ReadOnlySpan<byte> message, CatalogPlan plan, ref TSink sink, RealmFrame frame = null) where TSink : ICommandSink, allows ref struct
Parameters
messageReadOnlySpan<byte>The message.
planCatalogPlanThe session's compiled catalog.
sinkTSinkReceives the commands, only once the whole message has been validated.
frameRealmFrameThe realm frame a realm-framed field decodes over, at CommandPositionBits.
Type Parameters
TSinkThe sink type.
Exceptions
- WireFormatException
The message is malformed; nothing reached
sink.
Write(ref WireWriter, uint, IReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)>, RealmFrame)
Writes a COMMANDS message, type byte included.
public static void Write(ref WireWriter w, uint clientTick, IReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)> commands, RealmFrame frame = null)
Parameters
wWireWriterThe writer.
clientTickuintThe client's tick for the batch.
commandsIReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)>At least one command: its type, sequence and field values.
frameRealmFrameThe session's realm frame: a realm-framed field travels over its bounds at CommandPositionBits (ForCommands).
WriteCommand(ref WireWriter, MessagePlan, ushort, RecordValues, RealmFrame)
Writes one command of a COMMANDS message — varu cmdTypeIdx | u16 seq | fields — for a caller that writes the header itself.
public static void WriteCommand(ref WireWriter w, MessagePlan type, ushort seq, RecordValues values, RealmFrame commandFrame)
Parameters
wWireWriterThe writer.
typeMessagePlanThe command type.
sequshortIts sequence number.
valuesRecordValuesIts field values, by name.
commandFrameRealmFrameThe realm frame at command width (ForCommands), or null.
WriteCommand<T>(ref WireWriter, MessageBinding<T>, ushort, in T, RealmFrame)
Writes one command of a COMMANDS message from its struct, through a MessageBinding<T>: no name lookup, no allocation.
public static void WriteCommand<T>(ref WireWriter w, MessageBinding<T> binding, ushort seq, in T command, RealmFrame commandFrame) where T : unmanaged, IReplicatedMessage
Parameters
wWireWriterThe writer.
bindingMessageBinding<T>The struct bound to the catalog's command.
sequshortIts sequence number.
commandTThe command.
commandFrameRealmFrameThe realm frame at command width (ForCommands), or null.
Type Parameters
TThe command struct.