Architecture
Spectra Server implements a dual WebSocket architecture using Socket.IO, separating incoming game data from outgoing frontend data for optimal performance and security.Port 5100: Incoming Game Data
Observer clients and auxiliary clients connect to port 5100 to send game data to the server.- Observer clients: Send match data from VALORANT observer mode
- Auxiliary clients: Send player-specific data (abilities, health, scoreboard)
- Authentication required: All clients must authenticate before sending data
- SSL/TLS support: Configurable secure connections
Port 5200: Outgoing Data Stream
Frontend applications connect to port 5200 to receive processed match data.- Room-based broadcasting: Clients join rooms by
groupCode - Filtered data: Internal fields and secrets removed before emission
- Real-time updates: Instant
match_dataevents as game state changes - No authentication required: Simple logon with group code
Socket.IO Configuration
Both WebSocket servers use identical Socket.IO compression settings for optimal bandwidth usage:Compression Settings
- perMessageDeflate: WebSocket compression enabled
- Deflate chunk size: 1KB for efficient memory usage
- Deflate level: 3 (balanced compression vs. speed)
- Inflate chunk size: 10KB for decompression buffer
- Threshold: Messages over 1KB are compressed
CORS Configuration
- origin:
"*"- All origins allowed - Frontend clients can connect from any domain
The wildcard CORS setting (
"*") allows connections from any origin. For production deployments, consider restricting this to specific domains.SSL/TLS Support
Both servers support secure WebSocket connections (WSS) via SSL/TLS certificates.Configuration
Set environment variables to enable SSL:Insecure Mode
For development environments, disable SSL:When
INSECURE=true, the server creates HTTP servers instead of HTTPS. This should only be used in local development environments.Data Flow
- Observer/Auxiliary clients authenticate and send game data to port 5100
- Match Controller processes and validates incoming data
- Port 5200 broadcasts filtered data to all frontend clients in the room
- Frontend clients receive real-time updates via
match_dataevents
Connection Lifecycle
Incoming Clients (Port 5100)
- Connect to
wss://server:5100orws://server:5100 - Emit
obs_logonoraux_logonevent with authentication data - Receive
obs_logon_ackoraux_logon_ackresponse - If authenticated, send
obs_dataoraux_dataevents - On disconnect, auxiliary clients are marked as disconnected
Outgoing Clients (Port 5200)
- Connect to
wss://server:5200orws://server:5200 - Emit
logonevent withgroupCode - Join room for that group code
- Receive
logon_successconfirmation - Receive
match_dataevents for that match
Error Handling
Both servers implement error event listeners:Next Steps
Incoming Connection
Learn about port 5100 observer and auxiliary connections
Outgoing Connection
Learn about port 5200 frontend connections
Authentication
Understand observer and auxiliary authentication flows
Data Events
Explore event types and data schemas