Vixen
02b45cc4
csharp
public static class InspectorProtocol

The wire format between the editor and a running build: a one-byte kind, then fields.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 13 owns the protocol and says what it must carry — browse the live hierarchy, read and write component values, live counters, and trigger a capture. This is that list and no more. Discovery and pairing are deliberately not here: which transport finds which device is Vixen.Net's question, and a protocol that opened its own socket would be a second answer to it.

⚠ Hand-written rather than JSON, and the reason is the far end. A phone streaming its entity tree over a phone's uplink is the case this exists for; the same tree as JSON is several times the bytes and needs a parser in the player. Every field below is a length-prefixed string or a fixed-width number, which is a reader in forty lines on both sides.

⚠ Little-endian, stated rather than assumed. Every platform this engine targets is little-endian today and one of them will not be; BinaryPrimitives makes the choice explicit and costs nothing where it already agrees.

⚠ A truncated message is refused rather than read past. A transport may hand over a datagram that was cut short, and a reader that trusted a length prefix would index off the end of a buffer on the editor's frame thread — which is a crash in the tool somebody attached because something was already going wrong.

Fields and properties (2)

  • public const ushort Version

    What this build of the editor speaks.

  • public const int MaximumStringBytes

    The longest string any field may carry.

Methods (13)

  • public static void WriteHello(IBufferWriter<byte> writer, string editor)

    Writes a Hello.

  • public static void WriteWelcome(IBufferWriter<byte> writer, string build)

    Writes a Welcome.

  • public static void WriteBare(IBufferWriter<byte> writer, InspectorMessage message)

    Writes a message with no fields.

  • public static void WriteEntity(IBufferWriter<byte> writer, RemoteEntity entity)

    Writes an Entity.

  • public static void WriteSetValue(IBufferWriter<byte> writer, ulong entity, string member, string value)

    Writes a SetValue.

  • public static void WriteCounter(IBufferWriter<byte> writer, RemoteCounter counter)

    Writes a Counter.

  • public static void WriteText(IBufferWriter<byte> writer, InspectorMessage message, string text)

    Writes a Command or a Result.

  • public static bool TryReadKind(ReadOnlySpan<byte> payload, out InspectorMessage message)

    Reads whichever message a payload holds.

  • public static bool TryReadGreeting(ReadOnlySpan<byte> payload, out ushort version, out string name)

    Reads a Hello or Welcome.

  • public static bool TryReadEntity(ReadOnlySpan<byte> payload, out RemoteEntity? entity)

    Reads an Entity.

  • public static bool TryReadSetValue(ReadOnlySpan<byte> payload, out ulong entity, out string member, out string value)

    Reads a SetValue.

  • public static bool TryReadCounter(ReadOnlySpan<byte> payload, out RemoteCounter counter)

    Reads a Counter.

  • public static bool TryReadText(ReadOnlySpan<byte> payload, out string text)

    Reads a Command or Result.

Used by (5)

  • FakeBuildVixen.Editor.Debugger.Tests
  • InspectorProtocolTestsVixen.Editor.Debugger.Tests
  • RemoteInspectorClientVixen.Editor.Debugger
  • RemoteInspectorTestsVixen.Editor.Debugger.Tests
  • RemoteInspectorViewVixen.Editor.Debugger