Integration Tools

HARDATA ECP (External Control Protocol)

Document version: 1.6.2
Public specification covered: HARDATA ECP 1.6
Revision date: November 18, 2026

Documentation revision 1.6.2 is corrective: it aligns this document with the Gateway implementation regarding default network exposure, error codes and control reasons, the fields of session.setup and the behavior of authenticate. It adds no messages, actions, or fields and does not change the public contract: ecp.version remains at 1.6; 1.6.2 identifies only this document revision.

Revision 1.6.1 added information and control for a second auxiliary window, aux2Window, retaining auxWindow for AUX 1. It reuses existing actions, events, and fields. No discovery messages or capability negotiation were added. An older installation may reject aux2Window with invalidWindow: receiving version 1.6 messages does not by itself guarantee AUX 2 support.

Public, self-contained documentation for developers of external HARDATA control applications. The field names, versions, and envelopes shown here are part of the interoperability contract and must be followed exactly.

Important: HARDATA ECP controls HDX in real time over WebSocket. To query or manage metadata, materials, and advertising traffic over HTTP, use the separate HARDATA API.

This document is self-contained. A person or AI should be able to develop a functional client app without consulting source code or additional documentation.

1. Purpose and conceptual model

The app connects to the HARDATA Gateway over WebSocket. The Gateway authenticates each logical session, arbitrates who can operate, correlates responses, and distributes state. Its communication with HDX is an internal implementation detail outside HARDATA ECP.

App 1 ─┐
App 2 ─┼─ WebSocket JSON / HARDATA ECP ─ Gateway HARDATA session & control ─ HDX Radio 4
App N ─┘

HARDATA ECP 1.6 is the only public protocol. All messages use the root ecpobject; the app neither knows nor interprets the private protocol between the Gateway and HDX.

App -- HARDATA ECP 1.6 --> Gateway -- protocolo interno --> HDX Radio

The Gateway handles sessions, authorization, control, and translation of commands, responses, and events. This separation allows HDX to evolve without passing that complexity to client applications.

HARDATA ECP 1.6 authenticates using HARDATA API access tokens. It does not accept username/password authentication or earlier ECP versions. Playlist item references use playlistItemIdidentities. The contract exclusively uses the ecp envelope and the field names defined here; there are no legacy public envelopes, aliases, or actions. The private Gateway–HDX protocol evolves independently and is never part of an app's contract.

snapshot.playlist and playlist.updated are self-contained: they publish actualPlaylistItemId, nextPlaylistItemId and the nodes from the same revision. The actualIndex and nextIndexfields are removed. Each material node publishes materialId, and title contains only the title, never a serialized row of columns.

HARDATA ECP 1.6 separates authentication from control rights. Any HARDATA user with a valid access token from the trusted API can authenticate a session and use the observation capabilities authorized for the app. To acquire a scope through control.request, the authenticated user must also match the user currently active in HDX. This is a temporary condition and does not replace the app's persistent control, listener or denied authorization.

For Live, currentPageId represents the page visible in HDX. The app receives changes through state.liveCurrentPageChanged and, if it owns the livescope, can select it with setLiveCurrentPage.

2. Address, transport, and limits

2.1 Gateway discovery

The app knows the API URL from the installation configuration. It first obtains an access token via POST /api/v1/auth/login and queries GET /api/v1/stations/external-control with Authorization: Bearer <access-token>. The response is an array of connections containing workstationIp, workstationName, remoteAccess, station, studio and stationId.

In updated installations, workstationIp contains the IP:Puerto of the Gateway published by HDX. For example, 192.168.1.60:5030 is used with the /ecp path and the administrator-configured ws or wss scheme. This field does not contain a complete URL or specify the scheme. Do not replace its IP with localhost or assume a fixed port. The list identifies workstations with external control enabled; it does not guarantee that the Gateway is currently reachable.

2.2 Transport

Reference values:

  • WebSocket: ws://127.0.0.1:5180/ecp.
  • Transport: UTF-8 text WebSocket messages.
  • Each WebSocket message is a complete JSON document.
  • Maximum size: 1.048.576 UTF-8 bytes (1 MiB).
  • The Gateway supports WebSocket fragmentation and reassembles through EndOfMessage.
  • Newlines are not used as delimiters.
  • Message ordering within a WebSocket connection is preserved.

Multi-product deployment (three Gateway instances on the same computer or on different computers):

  • HDX: ws://127.0.0.1:5030/ecp
  • Dinesat: ws://127.0.0.1:5080/ecp
  • DinesatVisual: ws://127.0.0.1:5090/ecp

These endpoints are installation examples. For a client app, the HARDATA ECP contract does not change: always treat the Gateway URL as configurable and do not assume a fixed port.

A ws:// or wss://URL can be configured for another machine. The default installation listens on all interfaces (http://0.0.0.0:5030, :5080 or :5090 depending on the product) and does not provide TLS. Every network-accessible installation must implement WSS, firewall protection, and infrastructure authentication; do not assume the Gateway only accepts local connections.

Useful HTTP endpoints:

  • GET /: service information.
  • GET /health: { "status": "ok", "hdxConnected": true|false, "websocketClients": N }.
  • GET /ready: HTTP 200 when HDX is connected to the Gateway; 503 otherwise.

/ready is useful for diagnostics, but the app must also monitor connection.changed messages and the hdxConnected field in its session.

3. WebSocket client requirements

The client implementation must:

  1. accept text messages only;
  2. reassemble fragmented frames;
  3. validate UTF-8;
  4. reject or ignore messages larger than 1 MiB;
  5. serialize its own concurrent writes;
  6. keep a receive loop active throughout the session;
  7. generate a unique, nonempty requestId for every sent message;
  8. tolerate additional fields, new events, and unknown types;
  9. not log passwords, access tokens, refresh tokens, applicationKey or complete authentication messages.

Throughout HARDATA ECP, materialId is the Int64 identifier from HARDATA Database serialized as a canonical decimal string. It must be preserved as a string end to end; its full definition and relationship to HARDATA API are detailed in 10.7.

4. Required connection sequence

The correct sequence is:

Login HTTP al API → obtener access token y refresh token
Consultar terminales con control externo → elegir Gateway
Conectar WebSocket
  → enviar ECP `session.hello`
  ← recibir ECP `session.state`
  ← opcionalmente session.setup
  → enviar ECP `command.execute/authenticate` con params.token
  ← recibir ECP `command.result/applied`
  → pedir snapshots y suscripciones
  → si se operará: control.request
  ← esperar control.granted
  → enviar acciones mutantes
  → renovar el token mediante el API antes de vencer y presentar el nuevo con authenticate
  → cada scope permanece mientras se cumplan las condiciones de sesión, usuario y permiso

Do not send a HARDATA ECP action before session.hello. The Gateway requires session.hello within the first 10 seconds or closes the socket with PolicyViolation.

5. Session, authorization, and control

5.1 Envelope

{
  "ecp": {
    "version": "1.6",
    "type": "session.hello",
    "requestId": "gw-client-001"
  },
  "data": {}
}

App rules:

  • always send version = "1.6";
  • use a unique requestId for each ECP operation;
  • treat data as an object;
  • correlate responses when they repeat the requestId;
  • accept unsolicited events without a requestId and do not attempt to correlate them.

5.2 session.hello

This must be the first application message:

{
  "ecp": {
    "version": "1.6",
    "type": "session.hello",
    "requestId": "hello-001"
  },
  "data": {
    "clientId": "app-pc-estudio-01",
    "clientName": "Aplicación externa",
    "applicationType": "operator-ui",
    "applicationId": "<id-estable-de-aplicación>",
    "applicationKey": "<secreto aleatorio persistente>",
    "machineName": "ESTUDIO-01"
  }
}

Fields:

Field Type Requirement Semantics
clientId string recommended Stable instance identity. If omitted, the Gateway uses the session GUID.
clientName string recommended Human-readable name. If omitted, uses clientId.
applicationType string recommended App type, for example operator-ui, automation or observer.
applicationId string for operational access Stable installation identity.
applicationKey string for operational access Persistent random secret of at least 256 bits.
machineName string recommended Computer displayed by HDX during approval.

An app requesting control or listener authorization must send and persist applicationId and applicationKey. A session without stable identity receives no operational information. HARDATA ECP 1.6 exclusively uses applicationType; there are no public aliases for this field.

session.hello is sent only once per connection. A second session.hello is rejected with error and code = "invalidParams"; it does not replace the session identity. To change identity, open a new connection.

Response: ecp.type = "session.state".

5.3 Session state

Example of session.state:

{
  "ecp": {
    "version": "1.6",
    "type": "session.state",
    "requestId": "hello-001"
  },
  "data": {
    "sessionId": "55ef054f-1708-4787-ab7f-185c739be002",
    "clientId": "app-pc-estudio-01",
    "controlStates": {
      "air": "authenticationRequired",
      "live": "authenticationRequired"
    },
    "applicationAuthorization": "pending",
    "hdxConnected": true,
    "remoteControlAvailable": true,
    "connectionEpoch": "d9fdb740-5818-436a-99e5-8745fbc5a31e",
    "controllers": {
      "air": null,
      "live": null
    },
    "ownedScopes": [],
    "authenticated": false
  }
}

Each controlStates property independently describes the air or livescope. Its values are:

  • authenticationRequired: the session must authenticate.
  • userMismatch: the session is authenticated, but its user does not match the active HDX user; it may observe if app authorization allows, but cannot request control.
  • active: the session owns that scope.
  • authorizationPending: HDX has not yet decided the persistent permission.
  • listenOnly: the app may observe, query, and subscribe, but cannot request control.
  • denied: the app cannot access operational information.
  • available: the app has control permission and may request control through an explicit human action.
  • controlUnavailable: external control is disabled in HDX preferences.
  • backendUnavailable: there is not yet a valid operational session with HDX, either because the link is disconnected or the session identity is not registered.

applicationAuthorization has the value unknown, pending, control, listener or denied. authenticated indicates that the Gateway validated the access token and it has not expired. This is independent of persistent permission and hdxConnected. Operational availability also depends on the HDX connection, app permission, and controlStates.

Each WebSocket has an opaque sessionId generated by the Gateway. Two connections using the same token are separate sessions; reconnecting creates another session. Subsequent messages are associated with their connection: they contain neither a token nor a sessionId chosen by the app. Refreshing within the same WebSocket preserves the session.

The properties of controllers are published as null while the session lacks operational access (authenticated, registered identity in HDX, and control or listenerpermission), even if a controller is active. Each non- nullproperty contains:

{
  "sessionId": "...",
  "clientId": "otra-app",
  "clientName": "Operador principal",
  "applicationType": "operator-ui"
}

5.4 Requesting control

{
  "ecp": {
    "version": "1.6",
    "type": "control.request",
    "requestId": "control-001"
  },
  "data": { "scope": "air" }
}

Successful response: control.granted, only after HDX confirms the takeover. Negative response: control.denied. If HDX reclaims the scope locally while the request is pending, the request is invalidated with reason localTakeover; it is not automatically retried and cannot regain control through a late response.

The session must be authenticated as the same user currently active in HDX, have applicationAuthorization = control , and HDX must report remoteControlAvailable = true. At most one controller exists per scope. A valid request explicitly transfers only the specified scope: the latest authorized request for that scope wins and does not affect the other.

A cooperative app may send control.request only as a direct consequence of an explicit action by its user. It must not request or regain control based on a timer, reconnection, loss of ownership, or state change. The Gateway does not verify the human gesture or apply specific rate limiting for this rule.

5.5 Control lifetime

There is no application heartbeat. Each scope remains assigned to the session until another app with control permission requests that same scope, the app releases it, the connection is lost, external control is disabled, or the HDX operator locally reclaims that scope. Transferring, releasing, or locally reclaiming one scope does not affect the other. Token expiration, closing the WebSocket, changing the session's validated user, or changing/closing the local HDX session removes both scopes from that session. Local playback continues.

HDX maintains all known identities. An unknown identity triggers a single prompt to the operator, who chooses control, listener or denied. The decision is remembered and can be managed in HDX remote control properties. Losing control does not change that persistent permission.

5.6 Releasing control

{
  "ecp": {
    "version": "1.6",
    "type": "control.release",
    "requestId": "release-001"
  },
  "data": { "scope": "air" }
}

The session releases only the specified scope and receives control.revoked with the same requestId, scope and reason = "released". It may retain the other scope simultaneously.

5.7 Gateway events

ecp.type Recipient Main content
session.state session Complete session state.
control.granted session Complete state after granting the scope.
control.denied session Complete session state, scope, reason and controllers.
control.revoked session Complete state after losing or releasing the scope.
control.changed Apps with operational access Complete state personalized for the receiving session after a controller changes.
session.authorizationChanged session Complete state and persistent authorization decided by HDX.
connection.changed all hdxConnected, connectionEpoch.
error session code and message.

session.state, session.authorizationChanged and all control.* events always contain the base state defined in 5.3. control.granted, control.denied, control.revoked and control.changed add the affected scope ; the last three also add reason. An app replaces the complete received session state instead of combining fields from different events.

Revocation example:

{
  "ecp": {
    "version": "1.6",
    "type": "control.revoked"
  },
  "data": {
    "sessionId": "55ef054f-1708-4787-ab7f-185c739be002",
    "clientId": "app-pc-estudio-01",
    "controlStates": { "air": "available", "live": "active" },
    "applicationAuthorization": "control",
    "hdxConnected": true,
    "remoteControlAvailable": true,
    "connectionEpoch": "d9fdb740-5818-436a-99e5-8745fbc5a31e",
    "controllers": {
      "air": null,
      "live": {
        "sessionId": "55ef054f-1708-4787-ab7f-185c739be002",
        "clientId": "app-pc-estudio-01",
        "clientName": "Aplicación externa",
        "applicationType": "operator-ui"
      }
    },
    "ownedScopes": ["live"],
    "authenticated": true,
    "scope": "air",
    "reason": "localTakeover"
  }
}

session.state repeats the requestId from session.hello. State published as a result of authentication or refresh is unsolicited and omits requestId; the terminal response to that request is command.result or error. control.granted or control.denied repeat the one from control.request; the control.revoked response to control.release repeats that request's ID. Unsolicited changes and control.changed omit requestId.

connection.changed uses this exact payload:

{
  "ecp": {
    "version": "1.6",
    "type": "connection.changed"
  },
  "data": {
    "hdxConnected": false,
    "connectionEpoch": "b0fe01a2-9191-4020-bf0d-e131c7838244"
  }
}

Reasons for control.denied:

  • authenticationRequired
  • userMismatch
  • authorizationPending
  • listenOnly
  • applicationDenied
  • remoteControlUnavailable
  • localTakeover
  • hdxUnavailable

Observable revocation/change reasons:

  • replaced
  • released
  • disconnected
  • hdxDisconnected
  • tokenExpired
  • identityChanged
  • hdxUserChanged
  • authorizationChanged
  • localTakeover
  • remoteControlUnavailable

6. Commands, results, and errors

6.1 Action envelope

{
  "ecp": {
    "type": "command.execute",
    "version": "1.6",
    "requestId": "9b228692-203a-41bf-8871-ad2810c7be7a"
  },
  "data": {
    "windowId": "adsWindow",
    "action": "getWindowSnapshot",
    "params": {}
  }
}

Requirements:

  • ecp.type: command.execute.
  • ecp.version: exact string 1.6.
  • ecp.requestId: nonempty string unique among pending requests.
  • data.windowId: window identifier.
  • data.action: action name.
  • data.params: JSON object, even when empty.

Do not use data.value, legacy envelopes, or parameters packed into strings.

Windows recognized by Gateway subscriptions:

  • adsWindow
  • musicWindow
  • auxWindow: auxiliary playout 1.
  • aux2Window: auxiliary playout 2.
  • liveWindow

Global actions use windowId = "global".

On-air windows are adsWindow, musicWindow, auxWindow and aux2Window. Each auxiliary is identified by its number in HDX, regardless of its visible title or opening order; closing one does not renumber the other. aux1Window is not an alias for auxWindow. Auxiliary windows starting with the third are outside this contract even if they exist locally in HDX.

AUX 2 supports the same queries, commands, and events as AUX 1, with the same parameters and operational restrictions. The target is specified exclusively through data.windowId; no auxiliary number parameter is added.

AUX 2 query example:

{
  "ecp": {
    "type": "command.execute",
    "version": "1.6",
    "requestId": "aux2-snapshot-001"
  },
  "data": {
    "windowId": "aux2Window",
    "action": "getWindowSnapshot",
    "params": {}
  }
}

6.2 Action result

{
  "ecp": {
    "type": "command.result",
    "version": "1.6",
    "requestId": "9b228692-203a-41bf-8871-ad2810c7be7a"
  },
  "data": {
    "action": "play",
    "status": "applied",
    "windowId": "musicWindow",
    "playlistRevision": 81
  }
}

Possible statuses:

  • accepted: accepted but not yet terminal; keep the request pending.
  • applied: applied; successful terminal result.
  • rejected: rejected; failed terminal result.

Not all responses contain playlistRevision. The app must tolerate its absence.

6.3 HARDATA ECP error

{
  "ecp": {
    "type": "error",
    "version": "1.6",
    "requestId": "9b228692-203a-41bf-8871-ad2810c7be7a"
  },
  "data": {
    "windowId": "adsWindow",
    "action": "setActualById",
    "code": "invalidParameters",
    "message": "setActualById requires playlistItemId"
  }
}

An error is terminal. The canonical public fields are data.code and data.message; an app must not depend on an additional error object. The Gateway completes correlation on the first terminal response and suppresses subsequent duplicate private responses. sequence and timestampMonotonicMs are exclusive to states, snapshots, and updates; they do not appear in results or errors.

7. Token authentication and renewal

7.1 Obtaining and presenting an access token

The app sends a username and password exclusively to the installation API endpoint POST /api/v1/auth/login . The input JSON is { "username": "<usuario>", "password": "<contraseña>" }. A successful response contains success, message, token and refreshToken; require success and a nonempty token . The refresh token is sent only to the API.

After session.hello and receiving the operational configuration, send:

{
  "ecp": { "type": "command.execute", "version": "1.6", "requestId": "auth-001" },
  "data": {
    "windowId": "global",
    "action": "authenticate",
    "params": { "token": "<access-token>" }
  }
}

params contains exactly token, a nonempty string; any additional field produces an error with code = "invalidParams". Username, password, refresh token, and API address are not accepted as substitutes. The Gateway knows its trusted API through infrastructure configuration; the app cannot choose the validator. The app must treat the token as an opaque credential: decoding its claims does not prove authentication.

authenticate requires that the Gateway has already received HDX setup with a valid API address. Until then, the action fails with error, code = "hdxUnavailable" and message HDX setup is required; this is not a token rejection.

The Gateway validates the token with the API and establishes the session identity in HDX before confirming. It responds with command.result with the same requestId, action = "authenticate", windowId = "global" and status = "applied". The successful result also includes data.expiresAtUtc, an ISO 8601 UTC string with a Z suffix (for example, 2026-10-24T15:00:00Z; fractional seconds may be included), to schedule renewal; it is not a duration since connection. It also publishes an updated session.state . Persistent authorization may still be pending; authentication never grants control. If it fails, it returns a correlated terminal error and does not confirm applied.

A valid user other than the local HDX user may observe according to app permissions. To request control, both users must match and the app must have controlpermission. The match is reflected in controlStates: userMismatch , which prevents takeover without invalidating the token.

7.2 Renewal within the same session

The app refreshes through POST /api/v1/auth/refreshwith body { "refreshToken": "<refresh-token>" }. The response has the form of LoginResponse. It stores the new tokens and presents the new access token through the same authenticateaction, on the existing WebSocket, using a different requestId. Authentication requests are serialized: wait for a result before sending another.

  • The access token lasts 24 hours from issuance and is not revoked early. The Gateway uses its actual expiration; connecting or resending the same token does not start another 24-hour period.
  • A different token is validated against the API before being adopted. Repeating the current token for that session is idempotent and does not require another HTTP request.
  • While replacement is being validated, the previous token retains its validity and permissions. Rejection or an API outage does not extend it or invalidate it before expiration.
  • A valid renewal for the same user preserves the session and existing scopes. Changing users removes both scopes before updating identity; they are not restored automatically.
  • A late response cannot replace a newer token or reopen a closed session. If the previous token expires before replacement completes, the session closes; the app opens a new one using a valid token.
  • The token is not revalidated every 30 seconds, nor is the API polled periodically. The Gateway checks expiration locally and blocks messages and operational deliveries when it expires, even while the socket is still closing.
  • On expiration, it releases both scopes, removes the operational session, and closes the WebSocket with PolicyViolation (1008). A prior error is not guaranteed: closure may occur without a message, and cleanup does not depend on the app receiving a notification. There is no grace period.

The app refreshes before expiration with sufficient margin for the HTTP request and Gateway validation; it does not wait until the connection closes to begin renewal. It does not include the token in subsequent commands or in the WebSocket URL.

7.3 Failures and reconnections

A rejected token produces invalidToken; an expired token, tokenExpired; and an unreachable API or unusable response, apiUnavailable. A rejected new token does not replace the previous one while it is still valid. If authentication has not yet occurred, the connection remains without operational access and may retry while open. Avoid aggressive retries.

If the API goes down, previously validated sessions continue until their tokens expire. New tokens are not accepted without validation. An HDXServer outage alone does not disconnect apps or remove control: the API may remain available independently.

If the Gateway–HDX link is lost, the app stops operating, discards data from the previous connectionEpoch , and loses its scopes. The Gateway retains authentication while the token is valid and reestablishes identity when HDX reconnects. The app waits for updated operational state and requests snapshots and subscriptions again. Regaining control requires another human action; it is not automatic.

8. Actions and parameters

8.1 Actions that do not require control

The Gateway treats the following as read-only or local management actions:

Action windowId params Result
authenticate global token Validated by the Gateway against the API; initial authentication or renewal.
getWindowSnapshot window {} HDX emits snapshot.window with operational state, without collections.
getWeatherSnapshot global {} Publishes snapshot.weather for the station (section 24).
getPlaylist on-air window {} HDX emits snapshot.playlist.
setPlayerStateSubscription window rateMs Handled and aggregated by the Gateway.
clearPlayerStateSubscription window {} Handled by the Gateway.

setPlayerStateSubscription and clearPlayerStateSubscription respond locally with command.result/applied. For each window, including liveWindow, the Gateway aggregates requests and forwards only the necessary rate to HDX. The app's complete identity is declared once in session.hello.

8.2 Playback and state

These actions target on-air windows and require ownership of the air:

Action Typed parameters Semantics
play {} Starts or resumes playback.
pause {} Pauses playback.
stop {} Stops playback.
fadeOut {} Requests a fade-out of current playback. Subsequent behavior depends on the local HDX state.
setOutput { "output": "pgm" } Selects PGM/CUE idempotently.
setPositionMs { "positionMs": 42850 } Seeks the current material to a position in milliseconds.
setActualById { "playlistItemId": "456" } Sets the current item by playlist identity.
setNextById same as above Sets the next item by identity.
selectForPlayById { "playlistItemId": "456" } Selects the item for playback.
setTalkOver { "enabled": true } Idempotent talk-over state.
setStopAtEnd { "enabled": true } Idempotent stop-at-end state.
setAutoEnabled { "enabled": true } Idempotently enables or disables AUTO in adsWindow.
setAutoMode { "mode": "externalControl", "sourceId": null } Selects the automatic mode; stream modes require sourceId.
mainVolume { "volume": 70 } Sets the main volume.
auxVolume { "volume": 70 } Sets the auxiliary volume.
clearList {} Clears the window playlist.
toggleAscendingTimer { "enabled": true } Configures the ascending timer.

In setTalkOver, setStopAtEnd and setAutoEnabled, enabled is required and must be boolean. These are absolute assignments, not toggles. setAutoMode accepts the names published in availableModes; externalControl corresponds to EXT CTRL in the HDX interface. stream and streamDtmf require a sourceId published in streamSources.

Treat playlistItemId as an opaque string even when some values look numeric. Do not use index as a persistent identity.

8.3 Playlist editing

All of these target on-air windows and require ownership of the air:

Action Parameters
selectItems { "playlistItemIds": ["101", "102", "103"] }
deleteSelected { "playlistItemIds": ["101", "102", "103"] }
copySelected { "playlistItemIds": ["101", "102", "103"] }
pasteClipboard { "anchorPlaylistItemId": "105" }; the anchor is optional.
moveItemBefore { "playlistItemId": "103", "beforePlaylistItemId": "101" }; destination optional depending on the operation.
insertMaterial { "anchorPlaylistItemId": "105", "materialId": "9001" }
insertOverlay { "anchorPlaylistItemId": "105", "materialId": "9002", "offsetSeconds": 3 }; optional nonnegative integer offset, measured from the anchor file's zero position.
insertBlock { "title": "Bloque", "time": "12:30:00" }

playlistItemIds is a nonempty JSON array of opaque strings. The Gateway validates its type and internally translates the representation required by HDXECP; the private form is never exposed to the app.

A voice-over app may replace its own overlay before playout by using deleteSelected targeting only the overlay node's playlistItemId and then inserting the replacement. This deletes the playlist instance, not the material stored in the library.

To place a voice after the effective audio start, especially with crossfades, the app must consider both StartPos and PunchIn. AI Announcer computes offsetSeconds = ceil(max(StartPos, PunchIn) + demoraDeSeguridad), with a minimum 2-second safety delay. It always rounds up to prevent the overlay from being placed before the effective playback point. The application must confirm insertion through a subsequent playlist.updated containing the overlay node associated with the anchor; a command.result/applied alone does not replace that state confirmation.

insertBlock.time uses HH:mm:ss and supports extended hours from 00:00:00 through 30:00:00, associated with the playlist's operational date.

8.4 Actions for liveWindow

A button's identity is (pageId, buttonNumber), with an opaque pageId and a 1-based buttonNumber within the 1..100.

Action Typed parameters Control required
getLivePages {} no
getLivePage { "pageId": "42" } no
getWindowSnapshot {} no
ensureLivePage { "label": "Operador IA" } Live
setLiveButton { "pageId": "42", "buttonNumber": 1, "materialId": "9001" } Live and own page
clearLiveButton { "pageId": "42", "buttonNumber": 1 } Live and own page
playLiveButton { "pageId": "42", "buttonNumber": 1 } Live
stopLiveButton same as above Live
fadeOutLiveButton same as above Live
setLiveButtonPaused adds "enabled": true Live
stopAllLive {} Live
setAllLivePaused { "enabled": true } Live
setOutput { "output": "pgm" } Live
setLiveCurrentPage { "pageId": "42" } Live
setLiveMultiPlay { "enabled": true } Live
setLiveLoop { "enabled": true } Live
setLivePlayOver { "enabled": true } Live

Read operations require authentication and operational control or listenerauthorization. Mutations require control authorization and active ownership of the livescope. Only the app associated with a page may change its buttons; any Live controller may play buttons on readable pages.

enabled must be boolean, output only accepts pgm or cue, setLiveCurrentPage.pageId must identify an existing page, and the other specified parameters are required. Live actions follow the same optional command.result/accepted stage followed by a terminal result as other HARDATA ECP actions.

8.5 Extensibility

The public contract includes only the actions documented in this section. An app must not invent action names or rely on undocumented internal behavior. Future extensions will be documented and versioned within HARDATA ECP.

9. Subscription to playerStatus

Subscribe:

{
  "ecp": {
    "type": "command.execute",
    "version": "1.6",
    "requestId": "sub-music-001"
  },
  "data": {
    "windowId": "musicWindow",
    "action": "setPlayerStateSubscription",
    "params": { "rateMs": 500 }
  }
}

Unsubscribe: same structure with action = "clearPlayerStateSubscription" and params = {}.

Rules:

  • The Gateway applies a uniform per-app clamp of 200 response to 2000 ms for all windows.
  • If rateMsis omitted, it uses 500 ms.
  • Only authenticated app subscriptions are aggregated.
  • For each window, the Gateway requests from HDX the fastest rate required by all apps.
  • Each app receives playerStatus at no more than its own requested rate.
  • Without a subscription for a window, the app does not receive playerStatus from that window.
  • AUX 1 and AUX 2 have independent subscriptions per session and windowId. Changing or canceling one rate does not affect the other. A subscription must use a recognized target; success is not confirmed for an identifier outside the contract.
  • Other public events do not depend on this subscription.
  • HDX may publish more frequently during transitions; the Gateway still enforces the app's individual limit.
  • When a session closes, the Gateway removes all of its contributions. If no apps remain subscribed to a window, it also clears the aggregated subscription in HDX.

10. HARDATA ECP events and snapshots

10.1 State envelope

{
  "ecp": {
    "version": "1.6",
    "type": "state.playbackStateChanged",
    "sequence": 991204,
    "timestampMonotonicMs": 92345678
  },
  "data": {}
}

sequence is monotonic per window for states emitted by HDX. timestampMonotonicMs is HDX process monotonic time, not a UTC timestamp. The app must store lastSequence per window and discard a state if sequence <= lastSequence. Every state, snapshot, or update contains both fields; session, control, result, and error messages do not.

Playlist identity by public message type for adsWindow, musicWindow, auxWindow and aux2Window:

ecp.type actualPlaylistItemId nextPlaylistItemId materialId playlistRevision nodes
state.playbackStateChanged no no no no no
state.actualNextChanged yes yes no no no
state.playerStatus yes yes no no no
snapshot.window yes yes no yes no
snapshot.playlist yes yes per node yes yes
playlist.updated yes yes per node yes yes

When the table says “yes,” the property is present even when its value is null. HARDATA ECP 1.6 does not define actualIndex, nextIndex or a playlistItemId alias for the current item. liveWindow uses (pageId, buttonNumber) is defined separately in section 22.

The six message types in this table apply to both auxiliary windows with their existing formats and corresponding data.windowId . The app tracks sequence, operational state, and playlist separately per window; it does not combine current/next identities or nodes across auxiliaries. Each auxiliary's sequence continues increasing when closed and reopened within the same HDX process; after a connectionEpochchange, the app discards previous sequences and state according to recovery rules.

Output and transport shared by On-Air and Live

output is required in windowSnapshot, playbackStateChanged and playerStatus. It supports pgm (AIR) or cue, even when stopped. In On-Air it belongs to the main player; in Live it is shared by the slots. On-air playback means transport playing and output pgm. A missing output value does not imply PGM.

setOutput receives params: { "output": "pgm" } or { "output": "cue" } in musicWindow, adsWindow, auxWindow, aux2Window or liveWindow. It requires control authorization, valid identity, and ownership of the corresponding air or live scope. If the selection already matches, it confirms applied without stopping or recreating players. Missing, mistyped, or other parameter values are rejected without effect.

Changing output stops the affected playback and prepares players for the new destination without resuming automatically. It confirms applied only if successfully applied. A local restriction such as AUTO that prevents the change causes rejection; a preparation failure causes an error. Neither nonexistent success nor nonexistent active playback is reported.

playbackStateChanged immediately publishes consistent operational state whenever transport, output, or included modes change, whether locally or remotely, regardless of subscriptions. During the transition, the new output is not combined with active transport from before it was applied. After a failure, the actual resulting state is reported. There is no separate outputChanged.

In On-Air, the event contains windowId, output, playbackState, talkOverEnabled, stopAtEndEnabled, mainVolume and auxVolume.

In Live, it contains windowId, output, multiPlayEnabled, loopEnabled, playOverEnabled, mainVolume and players. The full list replaces the previous one; every assigned slot contains playerIndex, pageId, buttonNumber, materialId and statewith the types and identities defined for Live telemetry. An empty list means no slots are assigned. It contains no timing or VU values.

Example data from playbackStateChanged object for Live:

{
  "windowId": "liveWindow",
  "output": "cue",
  "multiPlayEnabled": false,
  "loopEnabled": false,
  "playOverEnabled": false,
  "mainVolume": 100,
  "players": [
    {
      "playerIndex": 0,
      "pageId": "42",
      "buttonNumber": 1,
      "materialId": "9001",
      "state": "playing"
    }
  ]
}

The snapshot reconstructs output and transport on connection or reconnection. playerStatus retains timing and VU data and its periodic subscription; operational events do not replace it. All respect per-window sequence and general correlation rules. In the public protocol, the event is named state.playbackStateChanged.

FastCue remains outside the public player model in this version. Starting or stopping it does not change the main transport: a stopped main player with active FastCue remains stopped; a main player on air with simultaneous FastCue remains playing and pgm.

airCue and setLiveOutput are not part of 1.6. They are rejected as unsupported actions, without effect; there is no alias or automatic negotiation with 1.5.

10.2 playbackStateChanged

{
  "ecp": {
    "version": "1.6",
    "type": "state.playbackStateChanged",
    "sequence": 101,
    "timestampMonotonicMs": 45000
  },
  "data": {
    "windowId": "musicWindow",
    "output": "pgm",

    "playbackState": "playing",
    "talkOverEnabled": false,
    "stopAtEndEnabled": false,
    "mainVolume": 100,
    "auxVolume": 70
  }
}

Expected playback states: stopped, playing, paused. Tolerate future values.

10.3 actualNextChanged

{
  "ecp": {
    "version": "1.6",
    "type": "state.actualNextChanged",
    "sequence": 102,
    "timestampMonotonicMs": 45100
  },
  "data": {
    "windowId": "musicWindow",
    "actualPlaylistItemId": "456",
    "nextPlaylistItemId": "489"
  }
}

Both identifiers may be null.

10.4 playerStatus

For on-air windows:

{
  "ecp": {
    "version": "1.6",
    "type": "state.playerStatus",
    "sequence": 103,
    "timestampMonotonicMs": 45200
  },
  "data": {
    "windowId": "musicWindow",
    "onAirTimer": "00:12:34",
    "itemTimer": "00:01:28",
    "actualPlaylistItemId": "456",
    "nextPlaylistItemId": "489",
    "positionMs": 42850,
    "durationMs": 215000,
    "remainingMs": 172150,
    "phase": "intro",
    "output": "pgm",

    "playbackState": "playing",
    "vu": { "left": 73, "right": 69 }
  }
}

actualPlaylistItemId and nextPlaylistItemId may be strings or null. playerStatus does not publish materialId: the app resolves current and next materials against the nodes of the current snapshot. positionMs, durationMs and remainingMs are the canonical timing reference. Formatted timers are for display. phase may change as the player evolves; do not use a closed enumeration.

10.5 snapshot.window

Response from an on-air window to getWindowSnapshot:

{
  "ecp": {
    "version": "1.6",
    "type": "snapshot.window",
    "requestId": "window-snapshot-1",
    "sequence": 104,
    "timestampMonotonicMs": 45300
  },
  "data": {
    "windowId": "adsWindow",
    "output": "pgm",

    "playbackState": "playing",
    "talkOverEnabled": false,
    "stopAtEndEnabled": false,
    "mainVolume": 100,
    "auxVolume": 70,
    "actualPlaylistItemId": "456",
    "nextPlaylistItemId": "489",
    "positionMs": 42850,
    "durationMs": 215000,
    "remainingMs": 172150,
    "phase": "intro",
    "programGenerationId": "adsWindow:2026-08-08:20260807T221530",
    "playlistRevision": 81,
    "automatic": {
      "enabled": true,
      "mode": "externalControl",
      "sourceType": "externalControl",
      "sourceId": null,
      "sourceLabel": "EXT CTRL",
      "availableModes": ["music", "musicFade", "stream", "externalControl"],
      "streamSources": [{ "id": "stream-1", "label": "FM Principal" }]
    }
  }
}

The snapshot does not increment playlistRevision. programGenerationId identifies the playlist load to which the identities and revision belong; it changes upon a complete reload. automatic contains data only in adsWindow; for other on-air windows it is null. The liveWindow snapshot is defined in 22.6.

Each auxiliary maintains its own playlist generation and revision. References to playlistItemId resolve only within the specified window. Closing and reopening an auxiliary generates a new programGenerationId and invalidates references to its previous playlist. The actions setAutoEnabled, setAutoMode and the event state.autoStateChanged remain exclusive to adsWindow; they are not enabled for AUX 1 or AUX 2.

10.6 autoStateChanged

state.autoStateChanged is published when AUTO is enabled or disabled, its mode changes, or a stream source is selected. Its data contains the windowId: "adsWindow" and the same properties of the snapshot's automatic object are included. The app must use this event—or a later snapshot—to confirm an assignment was applied.

10.7 snapshot.playlist and playlist.updated

The names snapshot.playlist and playlist.updated appear directly in ecp.type:

{
  "ecp": {
    "type": "snapshot.playlist",
    "version": "1.6",
    "requestId": "playlist-snapshot-1",
    "sequence": 105,
    "timestampMonotonicMs": 45400
  },
  "data": {
    "windowId": "musicWindow",
    "programId": "musicWindow:2026-08-08",
    "programGenerationId": "musicWindow:2026-08-08:20260807T221530",
    "operationalDate": "2026-08-08",
    "playlistRevision": 81,
    "actualPlaylistItemId": "456",
    "nextPlaylistItemId": "489",
    "nodes": [
      {
        "playlistItemId": "456",
        "materialId": "123",
        "index": 4,
        "nodeType": "material",
        "parentIndex": null,
        "level": 1,
        "childrenCount": 0,
        "relativeStartOffsetSeconds": null,
        "scheduleOffsetSeconds": null,
        "scheduledAt": null,
        "title": "Título",
        "dcs": "",
        "mediaType": "audio",
        "overType": ""
      }
    ]
  }
}

Rules:

  • snapshot.playlist reports the current list without incrementing the revision.
  • playlist.updated represents any detected structural change, whether local, remote, or a complete reload.
  • Within the same programGenerationId, every structural change increments playlistRevision. A complete reload changes programGenerationId and may reset the revision.
  • programId identifies the logical program; programGenerationId identifies a specific immutable load of that program.
  • operationalDate uses yyyy-MM-dd uses
  • actualPlaylistItemId and nextPlaylistItemId and represents the editorial date of the PGM, which may continue past midnight. nullmay be
  • playlistItemId ; otherwise they must identify nodes within the same message.
  • materialId identifies the material in the HARDATA platform; it is used to retrieve metadata and related resources through HARDATA API.
  • playlistItemId and materialId are not interchangeable: the same material may appear multiple times in a playlist, each occurrence having its own playlistItemId.
  • Treat playlistItemId as an opaque string even if its content appears numeric. Do not infer meaning or construct it from other fields.
  • materialId is the Int64 from HARDATA Database serialized as a canonical decimal string: only 0 or a sequence without a leading zero between 1 and 9223372036854775807. Signs, spaces, and exponential notation are not allowed.
  • The app must preserve materialId as a string and use it literally in /api/v1/material/{materialId}. In JavaScript it must not convert it to Number; it may use a string or BigInt for local validation only.
  • materialId is required and nonempty for material and overlaynodes; it is null for block.
  • nodeType uses only block, material or overlay.
  • index is required and unique within the message; it expresses only the current order and must not be used as a persistent identity.
  • parentIndex and relativeStartOffsetSeconds and represents the editorial date of the PGM, which may continue past midnight. null have meaning only within the same snapshot.
  • scheduleOffsetSeconds is the offset in seconds from the start of operationalDate and may represent extended hours up to 30:00.
  • scheduledAt is the absolute ISO 8601 date and time with UTC offset corresponding to that offset.
  • title contains only the material title or block description. It never contains HTML, headings, other columns, or tab-separated values.
  • Additional editorial metadata is queried through HARDATA API using materialId; it is not replicated as playlist columns.
  • Dynamic state is not duplicated in nodes: current/next come from the top-level identities, and playback, pause, position, and VU come from state events.
  • A full reload may reassign identifiers.
  • Locally replace the entire playlist with data.nodes upon receiving either message type.
  • Atomically update programId, programGenerationId, operationalDate, playlistRevision, actualPlaylistItemId, nextPlaylistItemId and nodes.

11. session.setup

The Gateway publishes installation information when HDX is available. It delivers it after session.hello, even before authentication:

{
  "ecp": {
    "type": "session.setup",
    "version": "1.6"
  },
  "data": {
    "remoteControlEnabled": true,
    "authRequired": true,
    "station": "Radio Uno",
    "workstation": "ESTUDIO-A"
  }
}

The app must treat the fields as informational and tolerate missing fields. The only version used to dispatch messages is ecp.version. Receiving session.setup does not mean the session is authenticated. The Gateway publishes only remoteControlEnabled, authRequired, station and workstation; it removes private fields from the HDX link (apiAddress, hdxUserName, hdxUserRevision and localControlRevisions). The API login URL is configured in the app. The Gateway does not accept a validation URL supplied by the app. session.setup does not expose secrets, the local user's identity, or private protocol revisions.

12. Distribution, cache, and correlation

The Gateway applies these rules:

  • session.setup: for sessions that sent session.hello.
  • Any result, error, or snapshot with a requestId: only to the session that originated the request.
  • Unsolicited operational states and updates without a requestId: only to authenticated sessions with control or listenerpermission. Session events and authentication errors are delivered to their recipient even before operational access is available.
  • playerStatus: additionally requires a subscription to the window.

Before forwarding an action to HDX, the Gateway substitutes the requestId with an internal ID and adds audit information. On receiving the response, it restores the original requestId . This mechanism is transparent to the app.

The Gateway may retain neutral internal state per connectionEpoch and logical resource, but does not automatically replay that cache when an app authenticates. For On-Air it maintains each window's operational state and playlist; for Live it maintains operational state, a catalog, and one page per pageId. A requested snapshot and its unsolicited update feed the same logical resource. The app starts synchronization through the explicit queries in section 17 and then receives future unsolicited publications.

When a Live catalog replaces the page list, the Gateway removes cached pages whose pageId no longer appears. Session-dependent fields such as ownedare always computed when projecting a message for its recipient; a personalized public payload is never cached or shared.

The app should design its store as an idempotent reducer and must not assume a rigid event sequence after authentication.

13. Gateway-generated errors

All public errors use ecp.type = "error":

{
  "ecp": {
    "version": "1.6",
    "type": "error",
    "requestId": "req-001"
  },
  "data": {
    "code": "controlRequired",
    "message": "Session does not own control"
  }
}
Code Meaning Recovery
invalidJson Invalid JSON. Correct serialization.
invalidEnvelope Missing ecp. Correct the envelope.
unsupportedVersion ecp.version is unsupported. Use a published version accepted by the Gateway.
helloRequired An operation was attempted before session.hello. Send session.hello.
invalidParams Required public parameters are missing or have an incorrect type. Correct data.params.
duplicateRequestId The requestId is already pending in this session. Use a new requestId or wait for the previous request's result.
authenticationRequired The session is not authenticated or its identity is not registered in HDX. Execute authenticate.
controlRequired Mutating action without control. Request control and wait for control.granted.
authorizationPending HDX has not yet decided. Wait for session.authorizationChanged.
applicationDenied HDX denied the app operational access. The operator can change its permission in HDX.
remoteControlUnavailable External control is disabled. Enable it in HDX workstation preferences.
actionNotAvailable The action is not part of HARDATA ECP 1.6, including local HDX operations and actions removed from earlier versions. Do not send it from an external app.
hdxUnavailable HDX is unavailable behind the Gateway, or sending failed. Wait for the operational session to recover, then resynchronize.
invalidToken The API rejected the presented token. Present a valid access token.
tokenExpired The presented or current token expired. Refresh through the API; if the socket closed, create another session.
apiUnavailable Validation against the trusted API failed. Retry with backoff without extending the previous token's lifetime.
requestTimeout HDX did not finish within the configured timeout. Mark the outcome as unknown and resynchronize; do not automatically repeat non-idempotent actions.
unknownMessageType ecp.type is unknown. Correct the type.

userMismatch and listenOnly are not error codes: they are reported in controlStates and as reasons for control.denied.

Additional observable HDX errors:

  • remoteControlDisabled
  • invalidWindow: unsupported identifier, including aux1Window and auxiliary windows starting with the third. The Gateway also emits it for subscriptions with an unrecognized target. In older installations it may also indicate that aux2Window is not yet supported. An invalid window in setOutput is rejected with invalidParams.
  • windowNotOpen: supported target whose window is closed; for example, aux2Window when Auxiliary Playout 2 is not open.
  • invalidParameters
  • notAllowed
  • invalidState
  • invalidTarget
  • invalidPlaylistItemId
  • invalidItemId

This list may grow. Display data.message to the operator and retain data.code for programmatic logic.

14. Recommended state machine

DISCONNECTED
  └─ WebSocket abierto → HELLO_SENT
       └─ session.state → UNAUTHENTICATED
            └─ authenticate/applied → OBSERVING
                 ├─ authorization control → AUTHORIZED
                 │    └─ gesto humano/control.request(scope)/control.granted → CONTROLLING(scopes)
                 │         └─ replaced/released/localTakeover(scope) → quitar sólo ese scope
                 ├─ authorization listener → OBSERVING
                 └─ authorization denied → DENIED
                 └─ desconexión HDX → BACKEND_UNAVAILABLE (sin control)
                      └─ recuperación HDX y sesión operativa → resincronizar

Vencimiento del token → cierre WebSocket → DISCONNECTED

Cualquier cierre WebSocket → DISCONNECTED

Do not enable mutating operations unless the session is authenticated, HDX is available, and ownedScopes contains the scope required by its window. Queries and subscriptions also require control or listenerpermission; authentication with pending authorization is insufficient.

15. Recommended local state

Maintain at least:

GatewayState
  websocketConnected
  hdxConnected
  connectionEpoch
  authenticated
  ownedScopes[]
  applicationAuthorization
  remoteControlAvailable
  controlStates.air / controlStates.live
  controllers.air / controllers.live

WindowState por windowId
  lastSequence
  playbackState
  talkOverEnabled
  stopAtEndEnabled
  mainVolume
  auxVolume
  actualPlaylistItemId
  nextPlaylistItemId
  positionMs
  durationMs
  remainingMs
  phase
  currentPageId
  vu.left
  vu.right
  playlistRevision
  programId
  programGenerationId
  operationalDate
  playlist[]

PendingRequest por requestId
  action
  windowId
  sentAt
  idempotent

When connectionEpochchanges, reset lastSequence, pending requests, control, and state whose validity depends on the previous HDX connection. Update authenticated from the Gateway session state: an epoch change does not itself expire the token.

16. Minimal implementation algorithm

Pseudocode:

connect(url):
  abrir WebSocket
  iniciar receiveLoop
  send("session.hello", identity)

onMessage(json):
  if json.ecp.version != "1.6":
    log and ignore
    return

  switch json.ecp.type:
    case "session.state", "session.authorizationChanged": update session
    case "connection.changed": reset state if connectionEpoch changed
    case "control.granted": add event.scope to ownedScopes
    case "control.denied": update state for event.scope
    case "control.revoked": remove event.scope from ownedScopes
    case "command.result": correlate; finish unless status == "accepted"
    case "error": correlate and finish as failure
    case "snapshot.window": replace window snapshot
    case "snapshot.playlist", "playlist.updated": replace playlist atomically
    case "snapshot.livePages", "livePages.updated": replace Live catalog atomically
    case "snapshot.livePage", "livePage.updated": replace Live page by pageId
    case type starts with "state.": apply event if sequence is newer
    default: log and ignore

sendAction(window, action, params):
  require authenticated and hdxConnected
  require applicationAuthorization in [control, listener]
  if action is mutating: require ownedScopes contains scopeFor(window)
  requestId = new UUID
  store pending request
  send text JSON with HARDATA ECP 1.6 envelope

17. Recommended startup after authentication

For each window the app will display:

  1. getWindowSnapshot.
  2. setPlayerStateSubscription with rateMs = 500.

For an on-air window, also request getPlaylist. For liveWindow, request getLivePages and then getLivePage only for pages whose content the app needs to materialize.

The same sequence applies individually to auxWindow and aux2Window. To check its availability, use getWindowSnapshot: windowNotOpen to indicate a closed auxiliary window; this does not prevent synchronization of other windows. No auxiliary open/close catalog or events are defined in this revision.

For an app with control:

  1. permission, check remoteControlAvailable = true;
  2. wait for the user to explicitly click “Take control”;
  3. send a single control.request with the corresponding scope;
  4. wait for control.granted;
  5. enable mutating controls.

There is no need to wait sequentially for the first three results before processing events. Correlate each request independently.

18. Safe reconnection

When WebSocket closes:

  • mark control and authentication as lost;
  • mark pending requests as having unknown outcomes;
  • reconnect with backoff, for example 1, 2, 5, 10 seconds with jitter;
  • restart from session.hello.

After requestTimeout, do not automatically repeat mutating actions such as insertMaterial, deleteSelected, moveItemBefore or playback changes. The action may have been applied even if its response was lost. First request snapshot.window; for On-Air also request snapshot.playlist and for Live getLivePages plus any required getLivePage snapshots.

Idempotent actions (setTalkOver, setStopAtEnd and absolute volume/position values) may be retried only after resynchronizing and regaining control.

After windowNotOpen, the app invalidates the affected window's state and playlist references; the Gateway invalidates its cache for that window. When using it again, the app requests getWindowSnapshot, getPlaylist and sets up setPlayerStateSubscriptionagain. Closing an auxiliary ends its HDX subscription; reopening it does not restore that subscription or itself change the shared aircontrol. No commands are defined for opening or closing HDX windows.

19. Security

  • Do not store or log plaintext passwords.
  • Send usernames and passwords only to the API; protect HTTP with HTTPS and WebSocket tokens with WSS for network access.
  • Do not log tokens or include them in URLs; send only the access token to the Gateway.
  • Do not attempt to access the private Gateway–HDX link or request its infrastructure secrets.
  • Validate certificates when using WSS.
  • Enforce size limits before serializing/sending.
  • Escape displayed content such as titles; do not interpret received HTML.
  • Treat names, titles, and error messages as untrusted data.
  • Separate observation and control permissions in the UI.

20. App acceptance checklist

Transport

  • Connects over ws/wss and uses UTF-8 text.
  • Reassembles fragments and enforces the 1 MiB limit.
  • Serializes concurrent sends.

Session

  • Sends session.hello immediately.
  • Processes all known HARDATA ECP 1.6 message types.
  • Authenticates each new WebSocket with an access token.
  • Refreshes before expiration and presents the new token; rejection does not extend the previous token.
  • Distinguishes token validity from HDX operational availability.
  • Does not mistake session.setup for successful authentication.

Control

  • Waits for control.granted before mutating.
  • Tracks independent owners for air and live and enforces the window's scope.
  • Waits for control authorization before enabling the control request button.
  • Sends control.request only as a direct result of the human action on that button.
  • Disables operations after revocation, disarming, or disconnection.
  • Releases control on orderly shutdown.

HARDATA ECP

  • Uses typed ecp.version = "1.6" and params .
  • Generates a unique requestId .
  • Correlates command.result, error and Gateway errors.
  • Keeps accepted pending until a terminal result.
  • Uses typed playlistItemId as identity and not index.
  • Uses typed materialId —when present—to retrieve material through HARDATA API.
  • Does not mistake materialId with playlistItemId.
  • Discards old sequences per window.
  • Atomically replaces playlists.
  • Tolerates nulls, missing fields, and extensions.

Recovery

  • Resets state when connectionEpoch.
  • Rebuilds snapshots and subscriptions after reconnection.
  • Does not repeat non-idempotent mutations after a timeout without reconciliation.

21. Independent On-Air and Live control

HARDATA ECP 1.6 separates external ownership into air (adsWindow, musicWindow, auxWindow, aux2Window) and live (liveWindow). control.request and control.release require data.scopewhose value is air or live. A session may own both scopes, and different apps may control On-Air and Live simultaneously.

Both auxiliaries share the airowner. A session already owning that scope does not request another takeover to operate AUX 2; the existing permissions, identity, and control conditions apply. There are no separate control owners or permissions per auxiliary.

{"ecp":{"version":"1.6","type":"control.request","requestId":"live-1"},"data":{"scope":"live"}}

Control events include scope, ownedScopes lists the session's scopes and controllers publishes the owner of each. Controllers of air and live are independent: they may be different apps, the same app, or unassigned. Every mutating action requires the corresponding lease for its windowId. Reclaiming local control in HDX revokes only that scope.

22. Contract for liveWindow

The only public iPlay interface is liveWindow. Legacy Candy/iPlay messaging is not part of HARDATA ECP, is not exposed through the Gateway, and does not establish names or compatibility for this contract.

The stable identity of a button is (pageId, buttonNumber). pageId is an opaque string and buttonNumber is 1-based within 1..100. Each applicationId may administer only one page of its own. Persistent ownership of that page is independent of the temporary controller of the livescope: owning a page does not grant control, and owning control does not grant administration of other apps' pages.

All apps with operational authorization may read pages. Any app owning the live scope may play buttons on any page, but may modify buttons only on pages it owns.

22.1 Reading and synchronization

Recommended flow:

  1. send getWindowSnapshot to obtain modes and players;
  2. send getLivePages to obtain the catalog;
  3. send getLivePage for each page whose content the app needs;
  4. send setPlayerStateSubscription to receive ongoing telemetry.

State responses retain the action's requestId . The terminal command.result confirms operation completion; receiving a correlated snapshot does not replace that result.

There are no pagesRevision or pageRevision because Live actions do not implement optimistic concurrency. Each publication is a complete snapshot of its resource, ordered by ecp.sequence from liveWindow. The Gateway caches by logical resource: one Live catalog and one page per pageId. The snapshot.* and *.updated variants replace the same resource; they do not create separate cache entries.

22.2 snapshot.livePages and livePages.updated

snapshot.livePages responds to getLivePages with the action's requestId . livePages.updated is published without requestId when the catalog changes. Both contain the complete catalog:

{
  "ecp": {
    "version": "1.6",
    "type": "snapshot.livePages",
    "requestId": "live-pages-1",
    "sequence": 210,
    "timestampMonotonicMs": 51000
  },
  "data": {
    "windowId": "liveWindow",
    "pages": [
      {
        "pageId": "42",
        "label": "Operador IA",
        "rows": 5,
        "columns": 5,
        "owned": true
      }
    ]
  }
}

pages is always present and may be empty. owned is always present and is computed for the receiving app by comparing its internal applicationId with the action's ownerApplicationId . HARDATA ECP never exposes the owner's identity. The Gateway customizes this field in responses and updates and does not share already-personalized payloads across sessions. When replacing the catalog, the app and Gateway discard any cached page whose pageId no longer appears.

22.3 snapshot.livePage and livePage.updated

snapshot.livePage responds to getLivePage and ensureLivePage. livePage.updated is published after setLiveButton, clearLiveButton or equivalent local modifications. Both contain the complete page:

{
  "ecp": {
    "version": "1.6",
    "type": "snapshot.livePage",
    "requestId": "live-page-1",
    "sequence": 211,
    "timestampMonotonicMs": 51020
  },
  "data": {
    "windowId": "liveWindow",
    "pageId": "42",
    "label": "Operador IA",
    "rows": 5,
    "columns": 5,
    "owned": true,
    "buttons": [
      {
        "buttonNumber": 1,
        "materialId": "9001",
        "label": "Separador apertura"
      }
    ]
  }
}

buttons contains only occupied positions. An absent valid position is empty. Dynamic button state is not taken from this snapshot: it is resolved against players from state.playerStatus using (pageId, buttonNumber). owned is always calculated for the receiving session, and ownerApplicationId is never published.

22.4 state.liveCurrentPageChanged

Published when the visible HDX page changes, either through local selection or setLiveCurrentPage. It does not require a state.playerStatus:

{
  "ecp": {
    "version": "1.6",
    "type": "state.liveCurrentPageChanged",
    "sequence": 212,
    "timestampMonotonicMs": 51030
  },
  "data": {
    "windowId": "liveWindow",
    "currentPageId": "42"
  }
}

currentPageId is an opaque string or null if no page is selected. The event does not carry the catalog or page contents; the app retrieves them via getLivePages and getLivePage.

22.5 state.playerStatus for Live

The Gateway aggregates subscriptions from all apps, requests from HDX the fastest rate needed for liveWindow , and delivers to each app no more than its individually requested frequency. This is the same mechanism used for on-air windows. A local or remote transition causes HDX to produce an immediate state; the Gateway may merge transitions within the rate-limit window and deliver the most recent state at the next permitted interval. state.playerStatus is a state snapshot, not a guarantee of receiving each button press as a separate event.

{
  "ecp": {
    "version": "1.6",
    "type": "command.execute",
    "requestId": "live-status-1"
  },
  "data": {
    "windowId": "liveWindow",
    "action": "setPlayerStateSubscription",
    "params": { "rateMs": 250 }
  }
}

The delivered telemetry has this form:

{
  "ecp": {
    "version": "1.6",
    "type": "state.playerStatus",
    "sequence": 213,
    "timestampMonotonicMs": 51040
  },
  "data": {
    "windowId": "liveWindow",
    "currentPageId": "42",
    "output": "pgm",
    "multiPlayEnabled": true,
    "loopEnabled": false,
    "playOverEnabled": false,
    "mainVolume": 100,
    "onAirTimer": "00:01:12",
    "itemTimer": "00:00:08",
    "vu": { "left": 73, "right": 69 },
    "players": [
      {
        "playerIndex": 0,
        "pageId": "42",
        "buttonNumber": 1,
        "materialId": "9001",
        "state": "playing",
        "positionMs": 4200,
        "durationMs": 12000,
        "remainingMs": 7800,
        "timerMs": 7800
      }
    ]
  }
}

currentPageId is an opaque string or null. state has the value playing, paused or stopped. players contains all slots assigned by Live. playerIndex is ephemeral and must not be persisted; the operational identity remains (pageId, buttonNumber). timerMs follows the timer direction configured in HDX.

22.6 snapshot.window for Live

getWindowSnapshot returns a single snapshot.window with the same operational state as state.playerStatus, including currentPageId, without catalog or page contents:

{
  "ecp": {
    "version": "1.6",
    "type": "snapshot.window",
    "requestId": "live-snapshot-1",
    "sequence": 214,
    "timestampMonotonicMs": 51060
  },
  "data": {
    "windowId": "liveWindow",
    "currentPageId": "42",
    "output": "pgm",
    "multiPlayEnabled": true,
    "loopEnabled": false,
    "playOverEnabled": false,
    "mainVolume": 100,
    "onAirTimer": "00:01:12",
    "itemTimer": "00:00:08",
    "vu": { "left": 73, "right": 69 },
    "players": []
  }
}

The app obtains the catalog via getLivePages and page contents via getLivePage. Thus, snapshot.window retains the same responsibility for On-Air and Live: describing only the window's operational state.

22.7 Administration, selection, playback, and modes

  • ensureLivePage returns or creates the single page manageable by the app and publishes correlated snapshot.livePages and snapshot.livePage messages.
  • setLiveButton and clearLiveButton publish the new complete livePage.updated .
  • Catalog changes publish livePages.updated .
  • setLiveCurrentPage may select any existing page and publishes state.liveCurrentPageChanged; the page does not need to belong to the app.
  • Playback and mode changes publish state.playbackStateChanged without a subscription; if a telemetry subscription exists, they also trigger an immediate state.playerStatus .
  • Attempting to change another app's page buttons, using an out-of-range button, or referencing a nonexistent page or material produces error and a rejected terminal result.
  • Assignments using enabled are idempotent; repeating the current value does not toggle state.

23. Full example workflow

The app first obtains an access token via HTTP login and selects a workstation from the API, as described in sections 2 and 7.

23.1 Identification

{"ecp":{"version":"1.6","type":"session.hello","requestId":"g1"},"data":{"clientId":"demo-1","clientName":"Demo","applicationType":"operator-ui","applicationId":"<id-estable-de-aplicación>","applicationKey":"<secreto-aleatorio-persistente>","machineName":"ESTUDIO-01"}}

applicationId and applicationKey must be persisted and reused across future connections. They form the identity HDX uses to remember whether the app is authorized as control, listener or denied; do not regenerate them when starting the process.

23.2 Authentication

{"ecp":{"type":"command.execute","version":"1.6","requestId":"a1"},"data":{"windowId":"global","action":"authenticate","params":{"token":"<access-token>"}}}

Wait for:

{"ecp":{"type":"command.result","version":"1.6","requestId":"a1"},"data":{"action":"authenticate","status":"applied","windowId":"global","expiresAtUtc":"2026-10-24T15:00:00Z"}}

The example expiration is illustrative: always use the expiration returned for the validated token. Renewal repeats authenticate with the new token and a different requestId; its result reports the new expiration.

23.3 Synchronization

{"ecp":{"type":"command.execute","version":"1.6","requestId":"s1"},"data":{"windowId":"musicWindow","action":"getWindowSnapshot","params":{}}}
{"ecp":{"type":"command.execute","version":"1.6","requestId":"s2"},"data":{"windowId":"musicWindow","action":"getPlaylist","params":{}}}
{"ecp":{"type":"command.execute","version":"1.6","requestId":"s3"},"data":{"windowId":"musicWindow","action":"setPlayerStateSubscription","params":{"rateMs":500}}}

23.4 Control

{"ecp":{"version":"1.6","type":"control.request","requestId":"g2"},"data":{"scope":"air"}}

Only after control.granted:

{"ecp":{"type":"command.execute","version":"1.6","requestId":"p1"},"data":{"windowId":"musicWindow","action":"play","params":{}}}

23.5 Transfer

After a human action, another app with control permission may request the same scope. The previous owner of that scope receives control.revoked with reason replaced; the other scope remains unaffected and there is no application heartbeat.


With this contract, an app can connect, authenticate, observe state, maintain playlists, acquire exclusive control per scope, execute actions, and correctly recover from disconnections without knowing the Gateway's or HDX Radio's internal code.

24. Station weather information

The Gateway publishes ecp.type: "snapshot.weather" in response to queries and ecp.type: "state.weatherChanged" for unsolicited updates. Both use ecp.version: "1.6".

The information refers exclusively to the city and source selected for the station published by ECP. No other-city catalog or actions to modify weather configuration are provided.

Queries and notifications

getWeatherSnapshot is a read action with windowId: "global" and params: {}. It requires an authenticated session and an app authorized as listener or control; ownership of control scopes or a match with the local user is not needed for observation.

The response is a complete snapshot correlated to the query's requestId , followed by the terminal applied according to the normal command lifecycle. unavailable and notConfigured are valid weather states, not command rejections. Failures that prevent a response from being built use the normal error lifecycle.

The change event sends the same complete object as the snapshot and replaces the previous one. It is emitted when values, update date, city, source, or availability change. It does not depend on setPlayerStateSubscription, has no telemetry cadence, and does not require an additional subscription action. It is distributed only to authorized sessions. A query does not force an update from the provider: it returns HDX's known state.

Snapshots and events use the sequence of the global and timestampMonotonicMsscope. A snapshot retains requestId; unsolicited events do not include it. On connection or reconnection, the app requests getWeatherSnapshot and respects sequence ordering to avoid overwriting newer data with older responses.

Weather data

The data object has this structure (illustrative values):

{
  "windowId": "global",
  "stationId": "123",
  "status": "available",
  "location": {
    "cityId": "3427458",
    "name": "Buenos Aires",
    "description": "Argentina"
  },
  "source": {
    "type": "openWeather",
    "name": "OpenWeather"
  },
  "updatedAtUtc": null,
  "units": {
    "temperature": "celsius",
    "windSpeed": "km/h",
    "pressure": "hPa",
    "distance": null,
    "rain": "mm"
  },
  "current": {
    "temperature": 22.5,
    "feelsLike": 23.1,
    "humidityPercent": 65,
    "condition": {
      "code": "800",
      "text": "Despejado"
    },
    "windSpeed": 12.3,
    "windDirectionDegrees": 180,
    "pressure": 1013.2,
    "pressureTrend": null,
    "visibility": null,
    "dailyRain": 0
  },
  "today": {
    "date": null,
    "temperatureMin": 16,
    "temperatureMax": 25,
    "sunriseLocalTime": null,
    "sunsetLocalTime": null
  }
}
  • stationId identifies the published station and is serialized as a string. location.cityId is an opaque string or null if configuration lacks an identifier; it is not used to query another city.
  • source.type distinguishes manual, weatherStation and openWeather. Clients must tolerate future sources. source.name is descriptive and contains no credentials or private configuration details.
  • All displayed fields are present. Fields not exposed by local state are represented as null. Numeric values available in HTH are published as maintained by HDX, including zeros; ECP cannot distinguish a measured zero from an initial HTH zero and does not add independent weather validation. Numbers have no symbols or locale formatting. Values from other sources are not mixed in to fill gaps.
  • units declares the units of the published values: temperature celsius or fahrenheit; speed km/h, m/s, mph or kn; pressure hPa, mmHg or inHg; distance km or mi; rainfall mm or in. An unknown unit is null and values dependent on it are also null. Humidity is expressed as a percentage, and wind direction as degrees from north.
  • condition.code is a string or null, interpreted together with its source; no universal coding scheme is assumed. condition.text is descriptive. pressureTrend accepts rising, steady, falling or null when the source does not report an interpretable trend.
  • updatedAtUtc is the data update timestamp in ISO 8601 UTC with Z, or null if unknown. It is not replaced by the query time or message emission time.
  • today.date is the city's local date in YYYY-MM-DD. Sunrise and sunset are local times in HH:mm corresponding to that date, or null if they cannot be associated with a known date. They are not UTC. Multi-day forecasts are not included.

In the current implementation, updatedAtUtc, units.distance, current.pressureTrend, current.visibility, today.date, today.sunriseLocalTime and today.sunsetLocalTime are always null. Their formats defined above remain in the contract for when HDX makes those data available. No additional information is fetched from another source to fill them in.

Availability and configuration changes

status Meaning
available Local HTH is initialized and has a selected source. This does not certify a recent successful query or the validity of every measurement.
unavailable No HTH instance is available for the published station, or it has not yet finished loading.
notConfigured The station has no configured weather information.

There is no stale state or automatic age-based transition. HTH is responsible for refreshing and retaining values. ECP reflects that local state and does not separately detect provider failures. Because updatedAtUtc is currently null, the app cannot determine the observation's age; receipt time does not indicate when it was measured either.

Published information reflects the local HDX weather state for the published station. ECP does not independently refresh sources. If no initialized local instance exists, status is unavailable; unknown identity, source, and units are null.

In unavailable retains known city/source identification and units; values in current and today are null (their structure is preserved, including condition with null fields), and updatedAtUtc is null. In notConfigured, location and source are null; the units, current and today structures are retained with all values null, and updatedAtUtc is null.

When the city or source changes, the complete state resulting from local HTH loading is published. ECP does not maintain an independent previous observation. Updates are notified when the published content changes, with no duplicate events for identical content. A weather failure does not disconnect ECP or remove remote control.