This document serves as a technical overview of the StageNet protocol. It includes the different data exchanges that are used to transfer data. The protocol is designed to abstract various hardware and data interfaces into a unified addressing and communication system.
Gateways advertise themselves on the network using mDNS (Multicast DNS). The console discovers available gateways by querying for devices advertising the StageNet service.
- Method: mDNS Service Advertisement
- Service Type:
_stagenet._tcp.local
- Port: 4000 (Default WebSocket port)
- TXT Records:
id
: String (Unique identifier for the gateway)type
: String (Type of gateway, e.g., "DMX", "MIDI")version
: String (Protocol version)
- Method: mDNS Query
- Service Type:
_stagenet._tcp.local
- Response: List of available StageNet gateways with their connection details
Gateway Service:
Name: gateway-01._stagenet._tcp.local
IP: 192.168.1.200
Port: 4000
TXT Records:
id=GATEWAY_01
type=DMX
version=1.0
After discovery, the console establishes WebSocket connections directly with each gateway.
- Method: WebSocket Connection
- URL:
ws://<gateway-ip>:<ws-port>/stagenet
After connection is established, gateways request a number of StageNet addresses. Once received, the gateway maps these to its hardware channels and informs the console of the mapping.
- Method: WebSocket Message
- Payload:
- Type:
LEASE_REQ
- Fields:
GatewayID
: String (Unique identifier for the gateway)AddressCount
: Integer (Number of StageNet addresses needed)
- Type:
- Method: WebSocket Message
- Payload:
- Type:
LEASE_RESP
- Fields:
LeaseID
: String (Unique identifier for this lease)Addresses
: Array of strings (Available StageNet addresses)
- Type:
- Method: WebSocket Message
- Payload:
- Type:
MAPPING_UPDATE
- Fields:
LeaseID
: String (The lease these mappings belong to)Mappings
: Array of objectsStageNetAddress
: String (The assigned StageNet address)HardwareType
: String (e.g., "DMX", "MIDI", "ANALOG")Channel
: Integer (The hardware channel number)
- Type:
LEASE_REQ
(GATEWAY → CONSOLE):
{
"Type": "LEASE_REQ",
"GatewayID": "GATEWAY_01",
"AddressCount": 4
}
LEASE_RESP
(CONSOLE → GATEWAY):
{
"Type": "LEASE_RESP",
"LeaseID": "lease_001",
"Addresses": ["SN1", "SN2", "SN3", "SN4"]
}
MAPPING_UPDATE
(GATEWAY → CONSOLE):
{
"Type": "MAPPING_UPDATE",
"LeaseID": "lease_001",
"Mappings": [
{"StageNetAddress": "SN1", "HardwareType": "DMX", "Channel": 200},
{"StageNetAddress": "SN2", "HardwareType": "DMX", "Channel": 201},
{"StageNetAddress": "SN3", "HardwareType": "DMX", "Channel": 220},
{"StageNetAddress": "SN4", "HardwareType": "DMX", "Channel": 430}
]
}
Once StageNet addresses are leased, the console sends control data using the assigned addresses.
- Method: WebSocket Message
- Payload:
- Type:
DATA_PKT
- Fields:
StageNetAddress
: String (Assigned StageNet address)Value
: Integer (The value to set, currently 0-255)
- Type:
DATA_PKT
(CONSOLE → GATEWAY):
{
"Type": "DATA_PKT",
"StageNetAddress": "SN1",
"Value": 255
}