Hub API¶
Every TriggerGate, whether a Windows service, an Advantech UNO or an ESP32 board, has the same SignalR hub, and everything the web page and the .NET client library do goes through it. This page is for developers who connect to the hub directly, from another language or without the library: how to connect, every command and notification with its payload, how the payloads are encoded, and the rules that keep a client working with servers of different versions. The type names are those of the contract package GameshowPro.TriggerGate.Common, which a .NET client can reference on its own.
Connect¶
| Endpoint | http://<host>:9090/TriggerGate on every server. The same path also answers on the HTTPS port: 9190 by default on Windows, 443 on the UNO and the ESP32 (see HTTPS settings and your own certificate). |
| Protocol | SignalR with the MessagePack hub protocol, on every server. The Windows and UNO services also accept SignalR's JSON protocol; the ESP32 does not. |
| Transport | WebSockets everywhere. The ESP32 offers no other transport; a client may negotiate first or skip negotiation. |
| Query | platform and device, both optional (see below). |
| Browser pages on another origin | Allowed. The Windows and UNO services accept the hub's GET and POST requests from any origin, with the X-Requested-With and X-SignalR-User-Agent headers, and the ESP32 answers the negotiate request from any origin. No origin is allowed credentials, so a browser client must not send them (in the JavaScript SignalR client, set withCredentials: false). A page served over HTTPS has to use the HTTPS port, because browsers block plain-HTTP connections from a secure page. |
A connection is bound to one platform instance (a platform, and a device on it) for its lifetime:
platformis aTriggerGatePlatformname, case-insensitive:AdvantechWindows,XKeysWindows,UnoorEsp32. Without it the connection goes to the server's default platform. See Platforms and devices.deviceis the device index on that platform, 0-based. Without it the connection goes to index 0. X-keys accepts 0 to 7, including an index that holds no device at the moment (it connects when a device appears there); the other platforms accept only 0.- A platform the server does not run, a name that is not a platform, or a device index out of range binds the connection to nothing. The server still accepts it and sends an initial state whose service state is Disconnected with the reason; no edges arrive, and every command fails with the same reason, except
GetTimeSample,GetDeviceLogInfoandGetDeviceLog, which belong to the server rather than to an instance. - The ESP32 has one platform and one device and ignores the query.
- In .NET,
HubQuery.Build(platform, deviceIndex)(namespaceGameshowPro.TriggerGate) returns the query without the leading?, leaving out whichever is null.
As soon as the connection is open the server sends InitialState, then a TimeSampled; the ESP32 sends a PtpStatusChanged between them. Notifications about an instance go only to the connections bound to it. DevicesChanged, ClockChanged and TimeSampled go to every connection, because the device list and the clock belong to the server.
Every command is a hub method with one argument, its request object, and returns a TriggerCommandResponse<T>:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Success |
bool | Whether the command did what was asked. |
| 1 | StatusDescription |
string? | Why not, or other detail. |
| 2 | Payload |
T? |
The result. Often null on failure. |
Encoding¶
On the MessagePack protocol, every request, response and report is written the same way unless the table below says otherwise:
- A record is an array of its members in key order; the tables on this page give each member's key. A request with no members is an empty array.
- Null is nil. A reader treats a missing trailing element as null, and skips elements beyond the ones it knows.
- An enum is its integer value. A
TimeSpanis an integer count of 100-nanosecond ticks. ADateTimeis a MessagePack timestamp (extension type -1), in UTC. AVersionis a string such as1.4.2. Abyte[]is binary. - A dictionary is a map.
| Type | Encoding |
|---|---|
IPAddress |
Binary: 4 bytes for IPv4, 16 for IPv6. |
IPEndPoint |
[address, port]. |
IPNetwork |
[base address, prefix length]. |
EdgeReport |
[formatVersion, version, index, ordinal, timeStamp, isRising, isTest, lockoutTimeRemaining, fromInterrupt, monotonicTime, absoluteTime]. See Edge. |
ServiceState |
[key, name, aggregateState, detail, progress, children], where children is an array of the same, and aggregateState is 0 Disconnected, 1 Warning, 2 Connected. |
ClockStatus |
[formatVersion, monotonicClockId, absoluteClockId, quality, estimatedError, lastStep, updatedAt, detail]. formatVersion is 1; estimatedError is ticks or nil; lastStep is nil or [at, size] (UTC ticks, ticks); updatedAt is UTC ticks or nil. A reader needs the first five elements. |
LockoutReport |
[formatVersion, version, index, timeStamp, isLockedOut]. |
UTC ticks are 100-nanosecond ticks since 0001-01-01 00:00 UTC, as in .NET's DateTime.Ticks.
On the JSON protocol, the same records are JSON objects with camelCase member names, IP end points are "address:port" and subnets "address/prefix". TriggerGate's own clients use MessagePack, which every server accepts.
Commands¶
| Command | Request | Payload | What it does |
|---|---|---|---|
ResetFaceoff |
ResetFaceoffRequest |
ResetFaceoffResponse |
Starts a faceoff between the given inputs, or ends the current one. |
ScheduleFaceoff |
ResetFaceoffRequest |
ResetFaceoffResponse |
ESP32 only. Starts a faceoff at a PTP instant. |
PrepareFaceoff |
PrepareFaceoffRequest |
PrepareFaceoffResponse |
Starts or ends a pre-faceoff lockout. |
TriggerRandom |
TriggerRandomRequest |
TriggerRandomResponse |
Sends test edges for the given inputs at random times. |
GetConfig |
GetConfigRequest |
GetConfigResponse |
Reads the instance's settings and what it can do. |
SetConfig |
SetConfigRequest |
SetConfigResponse |
Writes the instance's settings. |
IdentifyDevice |
IdentifyDeviceRequest |
IdentifyDeviceResponse |
Flashes the status output, to show which device this is. |
Shutdown |
ShutdownRequest |
ShutdownResponse |
Powers off a UNO; puts an ESP32 to sleep until it is reset. The Windows service refuses it. |
RunOsc |
RunOscRequest |
RunOscResponse |
Sends one OSC packet now, through the path a faceoff edge uses. Supported on ESP32 over IPv4 Ethernet. |
RunAction |
RunActionRequest |
RunActionResponse |
Applies one lighting patch now. Not on the ESP32. |
GetTimeSample |
GetTimeSampleRequest |
ClockTimeSample |
Reads the server's current time and clock status. |
GetPtpStatus |
GetPtpStatusRequest |
PtpStatus |
ESP32 only. Reads the board's PTP source. |
GetInputDiagnostics |
GetInputDiagnosticsRequest |
InputDiagnosticsSnapshot |
Reads each input's activity. See Input diagnostics. |
GetButtonHealthCapabilities, StartButtonHealthCheck, GetButtonHealthCheckStatus, RenewButtonHealthCheckLease, AdvanceButtonHealthCheckPhase, CancelButtonHealthCheck, GetButtonHealthCheckResult, GetButtonHealthCheckTrace |
One request type per command, named after it | ButtonHealthCapabilities, ButtonHealthSessionStarted, ButtonHealthStatus, ButtonHealthLease, ButtonHealthStatus, ButtonHealthStatus, ButtonHealthResult, ButtonHealthTracePage |
The button health check. See Button health check. |
GetDeviceLogInfo, GetDeviceLog |
GetDeviceLogInfoRequest, GetDeviceLogRequest |
DeviceLogInfo, DeviceLogPage |
The device's event log. See Device log. |
The button health and device log commands always carry a payload, even on failure: its Failure member gives the reason as a code, and Success is true exactly when Failure is None (0).
ResetFaceoff¶
ResetFaceoffRequest:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Inputs |
TriggerDefinition[]? |
The inputs taking part. Null ends the faceoff. |
| 1 | TriggerActions |
map of input index to TriggerActionsByResult, or nil |
Actions the server runs when an input wins or loses. See Trigger actions. |
| 2 | EdgeSource |
FaceoffEdgeSource |
0 Polling (the default) or 1 Interrupt: which kind of edge decides the faceoff. |
| 3 | Scheduled |
ScheduledFaceoffStart? |
Only with ScheduleFaceoff. Must be nil for ResetFaceoff. |
A TriggerDefinition is [input, risingEdge]: the input index and true when its rising edge (the button going down) is the one that counts.
The server answers each participant's first counted edge with an Edge carrying its place (Ordinal) and faceoff time; Triggers and faceoffs describes how the order and ties are decided. A request for Interrupt is refused if any participant cannot raise interrupts (see InterruptCapableInputPins in GetConfig); the server never falls back to polling. Ending a faceoff with actions (Inputs nil) runs every action supplied at once, in input order, winner before loser. A request whose actions do not validate is refused whole, and the current faceoff is left as it was.
ResetFaceoffResponse:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | ReferenceTime |
DateTime? |
When the faceoff was reset, on the server's clock. Null on a refusal. |
| 1 | HeldInputs |
int[]? | On a refusal because participants were already at their active level (a button held down), those inputs in ascending order. The request changed nothing. |
ScheduleFaceoff¶
ESP32 only. The request is a ResetFaceoffRequest with all four members: inputs (at least one), optional OSC trigger actions, EdgeSource 0, and Scheduled. Lighting actions are unsupported. ScheduledFaceoffStart has seven members, nil where unused:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Seconds |
long | The start instant on the PTP timescale: seconds. |
| 1 | Nanoseconds |
uint | And nanoseconds, below 1,000,000,000. |
| 2 | Domain |
byte | The PTP domain the board must be following. |
| 3 | Grandmaster |
byte[8] | The grandmaster identity it must be following. |
| 4 | Timescale |
PtpTimescale |
0 Ptp, 1 Utc, 2 Arbitrary. |
| 5 | LocalGeneration |
ulong? | The board's source generation (from PtpStatus.Generation). Leave null for one request sent to several boards. |
| 6 | MaximumErrorNanoseconds |
ulong? | The largest clock error the board may have at the start. A board whose error is unknown cannot meet a bound. |
If the board loses or changes its clock source before or during the faceoff, it cancels it and sends FaceoffCancelled.
PrepareFaceoff¶
PrepareFaceoffRequest:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Inputs |
TriggerDefinition[]? |
The inputs to watch. Null ends the pre-faceoff. |
| 1 | LockoutDuration |
TimeSpan |
Duration L from each qualifying early press; a qualifying refused press during the faceoff renews the same L. |
| 2 | EdgeSource |
FaceoffEdgeSource |
Which kind of edge causes lockouts. 0 Polling by default. |
A qualifying press during the pre-faceoff or during its carried lockout in the faceoff starts or restarts the full duration L and arrives as an Edge with LockoutTimeRemaining = L. It earns no place while locked out. A faceoff started while an input is locked out carries the lockout into it. A press strictly less than 200 ms after that input's last detected change in either direction is ignored before lockout and entry decisions, with no press report or lockout restart; the detected change still updates debounce history. Releases never restart a lockout. PrepareFaceoffResponse has the same members as ResetFaceoffResponse.
TriggerRandom¶
TriggerRandomRequest:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Inputs |
TriggerDefinition[] |
The inputs to send test edges for. |
| 1 | MinimumTime |
TimeSpan |
The earliest a test press may come, from now. |
| 2 | MaximumTime |
TimeSpan |
The latest. |
Each input gets a test press at a random time in the window and a release 0.2 seconds later, reported as edges with IsTest set and with places in the order of the presses, as in a faceoff. MaximumTime may be at most 4 seconds, and one sequence runs at a time. The server refuses the request while a button health check holds the device. TriggerRandomResponse has no members.
GetConfig¶
GetConfigRequest has no members. GetConfigResponse:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Settings |
Settings |
The settings the instance applies (below). |
| 1 | AvailableInputPins |
int[] | The pins the platform can use as inputs. |
| 2 | AvailableOutputPins |
int[] | The pins it can use as outputs. |
| 3 | AvailableSourceSubnets |
IPNetwork[] |
The subnets of the server's network interfaces, as choices for OscSourceSubnet. ESP32 reports its available IPv4 Ethernet subnet(s). |
| 4 | InterruptInputPins |
int[] | The inputs that always raise interrupts, and so are reported by interrupt as well as by polling. |
| 5 | InterruptCapableInputPins |
int[]? | The inputs that can be armed for a faceoff or pre-faceoff that asks for Interrupt. |
| 6 | OutputPinNames |
string[]? | What each output is called, in the order of AvailableOutputPins, where outputs are not numbered pins (X-keys: "Red light", "Green light"). |
| 7 | OutputsAreInputPins |
bool? | Whether an output number is also an input number, so the status output cannot be an input. |
| 8 | InterruptOrderingResolution |
TimeSpan? |
The smallest separation at which the instance can order two entries of an interrupt faceoff; closer entries are tied. |
| 9 | PolledOrderingResolution |
TimeSpan? |
The same for a polled faceoff. |
| 10 | Capabilities |
ConfigCapabilities? |
Which settings this server can change: [CanConfigureOsc, CanConfigureNtpServer, CanConfigureInputMapping, ClockSettingsNote]. |
Settings:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | StatusOutputPin |
int? | The output that shows input activity. Null for none. |
| 1 | InputPinMapping |
int?[]? | The physical pin of each logical input, by input index. |
| 2 | OscDestination |
IPEndPoint? |
Where an OSC action with no destination of its own is sent. Null uses the built-in default, 239.255.0.1:9000. |
| 3 | OscSourceSubnet |
IPNetwork? |
The subnet whose interface sends OSC. Null lets the operating system choose. |
| 4 | NtpServer |
string? | The NTP server, on platforms that manage their own NTP client. Null for the default. |
| 5 | OscTestAddress |
string? | OSC address used only by the web page and WPF Send test OSC buttons. Null or blank uses /triggergate/test. |
OscTestAddress must start with /, contain no control characters, and encode to at most 256 UTF-8 bytes. It does not change
addresses in faceoff actions or packets supplied to RunOsc. This optional trailing member preserves compatibility with existing
five-member settings records; when the ESP32 reads a record without key 5, it keeps any previously stored test address.
SetConfig¶
SetConfigRequest is [Settings, ReplaceSettings]. SetConfigResponse has no members. After a change the Windows and UNO services send Config to the instance's connections.
ReplaceSettings |
Windows and UNO services | ESP32 |
|---|---|---|
false (default) |
The settings replace the instance's, except NtpServer, which is never changed. |
A merge: a null status output or a null input in the mapping leaves that value as it was. NtpServer is not changed. |
true |
The settings replace the instance's. A different NtpServer is refused on Windows, whose clock is managed by the Windows time service; on the UNO it is applied where the device allows it. |
A complete record: null unassigns, and NtpServer is applied (null restores the default). |
Read Capabilities first: ESP32 reports OSC settings as configurable; the Windows and UNO services do not take an input mapping. ESP32 settings cannot change while a faceoff or pre-faceoff is armed, an input is locked out, or a button health check holds the device.
Trigger actions¶
TriggerActionsByResult is [Winner, Loser], each a TriggerActions or nil: the winner actions run on the input's 1st-place edge, the loser actions on any later edge. TriggerActions is [Osc, Lighting], each nil or:
| Type | Members |
|---|---|
OscAction |
[Packet, Destination, SourceSubnet]: the complete OSC packet (a message or a bundle) as binary, sent unchanged after its framing is checked; where to send it (nil uses Settings.OscDestination); and which subnet's interface sends it (nil uses Settings.OscSourceSubnet). |
LightingAction |
[StartIndex, Data]: a patch that overwrites a lighting universe from byte StartIndex. The server logs it; it has no lighting output. |
RunOscRequest is [OscAction] and RunActionRequest is [LightingAction]; their responses have no members. ESP32 supports RunOsc and refuses RunAction. ESP32 accepts IPv4 Ethernet OSC datagrams up to 1472 bytes and uses a bounded queue of 32 slots and 8192 bytes of prepared action payload. Queue exhaustion refuses direct RunOsc; faceoff OSC actions that cannot be queued are logged and dropped without invalidating faceoff timing. What the server does with the actions is in Trigger actions.
Shutdown and IdentifyDevice¶
ShutdownRequest, IdentifyDeviceRequest and IdentifyDeviceResponse have no members. ShutdownResponse is [ShutdownResponseCode]: 0 TimeOut (the device had not finished shutting down when the server answered, which is the normal answer from a UNO), 1 UnexpectedReturnCode, 2 NoPermission, 3 InvalidCall, 4 OtherError.
GetTimeSample and GetPtpStatus¶
ClockTimeSample:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | MonotonicTicks |
long | Ticks since the server's monotonic origin. |
| 1 | UtcTicks |
long? | The same instant in UTC ticks, when the server can map it to UTC. |
| 2 | Clock |
ClockStatus |
The server's clock status at that moment. |
| 3 | Ptp |
PtpStatus? |
The PTP source and instant, from an ESP32 that has one. |
| 4 | NtpDiagnostics |
NtpDiagnostics? |
The server's NTP observations, when it has an NTP probe: [Server, Address, SampleAgeMilliseconds, OffsetNanoseconds, RoundTripNanoseconds, RootDelayNanoseconds, RootDispersionNanoseconds, JitterMadNanoseconds, ModelUncertaintyNanoseconds, AcceptedSamples, LastReject, ComparedClockSourceId, Generation]. |
PtpStatus:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | Domain |
byte | The PTP domain. |
| 1 | Grandmaster |
byte[8] | The grandmaster identity. |
| 2 | Timescale |
PtpTimescale |
0 Ptp, 1 Utc, 2 Arbitrary (an epoch that must not be read as UTC). |
| 3 | Generation |
ulong | Changes whenever the board's source changes. |
| 4, 5 | Seconds, Nanoseconds |
long, uint | The current PTP instant. |
| 6 | EstimatedErrorNanoseconds |
ulong? | The estimated clock error. Null when unknown. |
| 7 | Locked |
bool | Whether the board is locked to the source. |
| 8 | Diagnostics |
PtpDiagnostics? |
[PhaseResidualNanoseconds, PhaseJitterMadNanoseconds, AcceptedSamples, SyncAgeMilliseconds, DelayAgeMilliseconds, ModelUncertaintyNanoseconds]: observations of the servo, not an error bound. |
GetTimeSampleRequest and GetPtpStatusRequest have no members. The ESP32 answers GetPtpStatus with a nil payload when it has no PTP status.
Notifications¶
| Notification | Argument | Sent |
|---|---|---|
InitialState |
InitialStateReport |
Once, as the connection opens. |
Edge |
EdgeReport |
For every reported edge of the bound instance. |
InputLevels |
bool[] | When input levels are known without an edge, one per input index. It carries no time, ordinal or trigger; it only updates the levels. |
ServiceState |
ServiceState |
When the bound instance's state changes. |
Config |
SetConfigReport |
Windows and UNO services: when the instance's settings change. SetConfigReport is [Settings]. |
DevicesChanged |
PlatformDevice[] |
Windows service: to every connection when the device list changes (an X-keys device plugged in or removed). Replace the list from the initial state. |
ClockChanged |
ClockStatus |
To every connection when the server's clock status changes in a way that matters: its quality, time source, error class or monotonic identity, or a step of the wall clock. |
TimeSampled |
ClockTimeSample |
To every connection, about once a second. |
PtpStatusChanged |
PtpStatus? |
ESP32: when its PTP source changes, and once after the initial state. |
FaceoffCancelled |
FaceoffCancellation |
When the server cancels a faceoff itself: [Reason, Generation]. The Windows service does this when interrupt events were lost (generation 0); the ESP32 when a scheduled faceoff's clock source is lost or changes, or its event queue overflows. |
FaceoffHealth |
FaceoffHealthReport |
Once when a faceoff or pre-faceoff ends: the stray activity of each input. See Input diagnostics. |
ButtonHealthCheckChanged |
ButtonHealthStatus |
When a button health check changes state or phase, and at most once a second while it captures. See Button health check. |
Lockout |
LockoutReport |
Part of the contract, but not sent by current servers: lockouts arrive as Edge reports with LockoutTimeRemaining. |
InitialState¶
InitialStateReport:
| Key | Member | Type | Meaning |
|---|---|---|---|
| 0 | ServiceState |
ServiceState |
The bound instance's state; when the request could not be met, Disconnected with the reason. |
| 1 | Edges |
EdgeReport[] |
The current level of every input of the bound device. |
| 2 | ServerInformation |
ServerInformation |
[Version, BuildDate, TriggerGatePlatform, HostName]: the server, and the platform the connection is bound to (or the one requested, when it is not available). |
| 3 | Settings |
Settings? |
The bound instance's settings. Nil from the ESP32. |
| 4 | AvailablePlatforms |
TriggerGatePlatform[]? |
Every platform the server runs. |
| 5 | BoundPlatform |
TriggerGatePlatform? |
The platform the connection is bound to; null when the request could not be met. |
| 6 | AvailableDevices |
PlatformDevice[]? |
Every device a client can bind to, grouped by platform in the order of AvailablePlatforms, then by index. |
| 7 | BoundDeviceIndex |
int? | The device index the connection is bound to; null when it is bound to nothing. |
| 8 | ServerClock |
ClockStatus? |
The server's clock status, sent whatever the binding. |
TriggerGatePlatform is 0 Uno, 1 AdvantechWindows, 2 XKeysWindows, 3 Esp32. PlatformDevice is [Platform, Index, Name, ProductId, SortKey, IsPresent]: the platform and index to put in the query, the device's model name (null where the platform does not name its devices), the USB product ID and sort key of an X-keys device, and whether a device is at that index now. A platform that drives one device at a time has exactly one entry, index 0.
ClockStatus members: MonotonicClockId names the server's monotonic clock (equal ids mean the readings can be subtracted), AbsoluteClockId names the time source of its wall clock (equal ids mean two servers follow the same source), Quality is 0 None, 1 System (not synchronized), 2 Ntp, 3 PtpSoftware, 4 PtpHardware, and EstimatedError is the time source's own estimate, not a measurement.
Edge¶
| Index | Member | Type | Meaning |
|---|---|---|---|
| 0 | format version | int | 2 from current servers. Read the two time fields only when it is 2 or more. |
| 1 | Version |
int | The report's version. Nil means no report: skip the rest. |
| 2 | Index |
int | The input, 0-based. |
| 3 | Ordinal |
int? | In a faceoff, the input's place as a zero-based number: 0 is 1st, 1 is 2nd, and so on. |
| 4 | TimeStamp |
TimeSpan? |
In a faceoff, the time since the faceoff started. |
| 5 | IsRising |
bool | True for the input going active (the button going down), false for its release. |
| 6 | IsTest |
bool | True for a test edge from TriggerRandom. |
| 7 | LockoutTimeRemaining |
TimeSpan? |
Set on each qualifying early or locked-out press, in the pre-faceoff or faceoff; a restart reports the renewed full duration L. |
| 8 | FromInterrupt |
bool | True when a hardware interrupt reported the edge, false when polling found it. |
| 9 | MonotonicTime |
TimeSpan? |
The edge's own time on the server's monotonic clock. |
| 10 | AbsoluteTime |
UTC ticks? | The same instant on the server's wall clock. |
What to know when reading edges:
- Ties. Within one faceoff, two entries have the same
TimeStampif and only if the server decided them as one tied group, whose order it chose at random. Compare faceoff times to find a tie; there is no flag.MonotonicTimeandAbsoluteTimebelong to each edge, so they differ within a tie: do not use them to detect ties. In .NET,FaceoffTies.FindTiedInputsapplies this rule to a list of (input, ordinal, faceoff time) entries and returns the tied inputs; entries without a place or a faceoff time, and entries for the same input, never count as tied. - Interrupt and polled observations. An armed Advantech input may be seen by interrupt and then by polling. The polled level is the authority on its current state; duplicate observations do not invent another press. Only the kind of edge the faceoff requested can carry an ordinal or start a lockout. A settled-level correction arrives as
InputLevels, without a syntheticEdgeor trigger. - Times.
MonotonicTimeis null when the server has no stamp for the edge (an initial level, a release reported because a device went away).AbsoluteTimeis null whenMonotonicTimeis, and on the ESP32 when its clock has no fresh mapping to UTC. Two servers' times are comparable only as far as theirClockStatussays; see Clocks and time and Accuracy.
Compatibility¶
The contract grows by appending: a member is only ever added at the end of a record, with a new key, and never changes type or meaning. A client that follows these rules works with servers older and newer than itself:
- Read leniently. Take the elements you know, skip extra ones, and read missing trailing ones as null. Accept enum values you do not know, in particular new
ClockQualityvalues. - Ignore unknown notifications. A newer server can send notifications your client has no handler for.
- Expect commands to be missing. A server that does not have a command answers with an error instead of a response; treat that as "not supported". The diagnostics, button health, device log and time sample commands are newer than the faceoff commands.
ScheduleFaceoffandGetPtpStatusexist only on the ESP32. The ESP32 answers commands it does not have, such asRunAction, with an unsuccessful response, "Unknown method". - Send only what you need. A request may stop after its last member you use: a
ResetFaceoffRequestof[inputs]is a polled faceoff without actions.EdgeSourcedefaults toPolling, so a request that does not say asks for polled edges.
What a missing (null) member means:
| Member | Read null as |
|---|---|
InitialStateReport.AvailablePlatforms |
The platforms are unknown: offer only the one in ServerInformation. |
InitialStateReport.BoundPlatform |
With AvailablePlatforms present: bound to nothing. With both null: the platform in ServerInformation. |
InitialStateReport.AvailableDevices |
One device, index 0, per platform. |
InitialStateReport.BoundDeviceIndex |
Index 0 when a platform is bound. |
InitialStateReport.ServerClock |
The server's clocks are unknown. |
GetConfigResponse.AvailableSourceSubnets |
Empty. |
GetConfigResponse.InterruptCapableInputPins |
Use InterruptInputPins. |
GetConfigResponse.OutputPinNames |
The outputs are numbered pins: show "GPIO n". |
GetConfigResponse.OutputsAreInputPins |
true. |
GetConfigResponse.InterruptOrderingResolution, PolledOrderingResolution, Capabilities |
Unknown. |
ResetFaceoffResponse.HeldInputs, PrepareFaceoffResponse.HeldInputs |
Not reported; the reason is in StatusDescription. |
EdgeReport elements 8 to 10 |
A polled edge without times. |
FaceoffHealthReport.Phase |
A faceoff report (0). |
The ESP32 firmware¶
The ESP32 implements the same contract for its eight inputs, with these differences:
- MessagePack over WebSockets only, on port 9090 and on its HTTPS port. It keeps at most 12 sockets open on port 9090 and 3 on HTTPS, and refuses a frame larger than 64 KiB.
- It ignores the query string, and sends no platform or device lists and no settings in its initial state.
- Its edges are all reported as polled (
FromInterruptfalse), andInterruptInputPinsandInterruptCapableInputPinsare empty or nil. It refuses a faceoff or pre-faceoff that asks forInterrupt. Faceoff and scheduled-faceoff OSC actions are supported; lighting actions are refused.RunOscis supported, whileRunActionis not. - A successful command that changes something (
ResetFaceoff,ScheduleFaceoff,PrepareFaceoff,TriggerRandom,SetConfig,IdentifyDevice,Shutdown) answers with no payload, so there is noReferenceTime; a refusal, including a held button, isSuccessfalse with the reason inStatusDescription. - It refuses
SetConfigwhile a faceoff or pre-faceoff is armed or an input is locked out ("GPIO is active"). - It has
ScheduleFaceoff,GetPtpStatusand thePtpStatusChangednotification, and does not sendConfigorDevicesChanged. - While a firmware update is being installed it answers every command except
GetConfigwith "Firmware update in progress".