Contents
- 1 Client vs Server
- 2 WebSocket protocol
- 3 Protocol URL
- 4 Protocol Version
- 5 JSON
- 6 Message Flow
- 7 No Ack/Nak
- 8 No Query Commands
- 9 Use Persistent Connections
- 10 Input/Output numbering
- 11 JSON Message fields
- 12 API on Postman
- 13 Messages from Server to Client
- 14 Messages from Client to Server
- 15 JavaScript implementation of WebSocket clients
- 16 Test Server
Most control protocols for Broadcast routers come from the era of RS422 serial comms. Even those routers which support control via IP tend to use proprietary protocols that are not easily compatible with web-based control applications.
The RouteMaster Websocket protocol was designed to use web standards to enable router control from web applications running on any modern browser. This allows web pages to easily control routers and receive status from any router controlled via the RouteMaster system.
RouteMaster Web Panels use this protocol to control routers connected to the RouteMaster system. RouteMaster can also use the same protocol to control routers that support it, or downstream RouteMaster systems.
Client vs Server
The ‘client’ is typically any application that wants to make routes or receive router status, and the ‘server’ is typically the RouteMaster system (or any other router using this protocol).
The ‘server’ typically listens for connections on TCP/IP port 81, although other ports can be configured. Servers support multiple simultaneous client connections. RouteMaster limits the number of simultaneous clients according to the number of installed licenses.
WebSocket protocol
Messages are exchanged between client and server using the WebSocket protocol, described in overview here. https://en.wikipedia.org/wiki/WebSocket
Unlike HTTP it offers a persistent full-duplex connection. RouteMaster V2.3.7 and later support encrypted Websockets (‘wss://hostname:portnum’’). This can be enabled in the RouteMaster client configuration dialog.
Protocol URL
When controlling RouteMaster from other systems such as Helm, you may need to enter the URL of the connection. like an HTTP URL, this has the format <protocol>://<host>:<port>
, where the protocol is ws
(or wss
for secure websockets)
In addition, optional query parameters can be appended which affect the operation of the protocol. currently the only one defined is the version
parameter.
Examples:
ws://localhost:81
wss://192.168.0.222:84
wss://webcentre.rascular.com:81?version=2
Protocol Version
The query parameter version specifies the version of protocol to be used. Version 1 is the default.
If Version 2, is specified, the multiple tallyCrosspoint
messages sent on connection are replaced with a single bulkCrosspoints
message.
JSON
WebSockets give a way of sending ‘messages’ between endpoints, but does not define the content and structure of those messages. Messages could be binary, XML or any proprietary format. RouteMaster uses JSON for the message structure, which fits well with JavaScript used in browser-side applications. http://json.org/
Message Flow
The protocol does not impose any restrictions on message flow. Messages can normally be sent by both client and server at any time, and in any order. However, when a new client connects to a server, it should be sent the entire router state including source and destination names, protect and crosspoint status.
The final message after the initial state has been sent will be the connectComplete
message.
No Ack/Nak
Messages do not implicitly cause Ack or Nak replies to be sent. but the success of messages forcing a change of state can be determined by the tally messages returning when an operation completes.
No Query Commands
There are no query commands to request state from RouteMaster. This is because the full router state is automatically sent to all clients when they connect, and clients are then automatically notified whenever the state changes.
Use Persistent Connections
Each time a WebSocket connection is established, the full router state with names, etc is sent to the client. Client software should keep the connection open, rather than opening it every time a command must be sent.
Input/Output numbering
All sources, destinations and levels are numbered starting from ZERO.
JSON Message fields
Every JSON message has a mandatory string field “event” which is describes the message type. A structure ‘data’ then contains parameters and data regarding the event. Unknown incoming events will be ignored, and unknown fields in the JSON data are also ignored.
API on Postman
We’re switching to Postman to design, test and document our APIs. Postman support for WebSocket APIs is improving, and you’ll find the RouteMaster API with example messages here.
Messages from Server to Client
Event | Function | Data` | Example |
---|---|---|---|
tallyCrosspoint |
Notifies client of crosspoint change | destination: integer sources : array of integers, one per level |
|
sourceName |
Notifies client of source name change | source: integer names : array of strings for names starting at specified source. |
|
destName |
Notifies client of destination name change | destination: integer names : array of strings for names starting at specified destination. |
|
levelName |
Notifies client of level name change | level: integer names : array of strings for names starting at specified level. |
|
routerData |
Basic information about the router size, etc | sources: integer dests: integer levels: integer name: string |
|
inputGroups |
Information about input (source) groups | TBC | |
outputGroups |
Information about output (destination) groups | TBC | |
protectState |
Notifies client of destination protect change | dest: integer state : array of .. { prot: “Unlocked”,”Locked” or “Protected” user: string } |
|
connectComplete |
Indicates that the initial status transfer to client has finished. | none |
|
salvoNames |
The list of available Salvo Names | names: array of strings |
|
bulkCrosspoints
V2 Only |
Bulk crosspoint tally sent on connection | array of tally information, as per the tallyCrosspoint message.
destination: integer |
|
sourceStatus |
Status and metadata information for sources | source: integer state: array of source status records starting at specified source. The data available for each source will depend on the router type and system configuration |
|
destStatus |
Status and metadata information for destinations | dest: integer state: array of destination status records starting at specified destination . The data available for each destination will depend on the router type and system configuration |
|
tielineStatus |
Messages from Client to Server
Event | Function | Data | Example |
---|---|---|---|
makeCrosspoint |
Request a crosspoint change. Will cause a tallyCrosspoint message to be returned when the route is made. |
destination: integer source: integer levels: |
|
lockOutput |
Lock/unlock an output. A protectState message will be returned. |
destination: integer state: “Locked”/”Unlocked”/”Protected” |
|
fireSalvo |
Fire a ‘salvo’ of multiple routes. Individual tallyCrosspoint messages will be received for each route made. |
id: name or id number of salvo to fire |
|
freeTieline |
Force a named tieline to become free, disconnecting any previous use of the tieline. | tieline: Name of tie-line to free |
|
JavaScript implementation of WebSocket clients
For a good overview of how to handle JSON-based WebSockets from JavaScript, see this page:
https://www.new-bamboo.co.uk/blog/2010/02/10/json-event-based-convention-websockets/
Test Server
You can try out the protocol using our online test server at wss://webcentre.rascular.com/routemaster . To easily view and test messages, just enter that URL at https://websocket.org/echo and ‘connect’.