#WebSocket Namespaces Configuration
To manage separate connections for the different bots (FC24, FC25, Undisputed) and separate remote controls / logger flows, the SPGG system uses Socket.IO namespaces.
#Namespace Definitions
Each bot connection establishes a socket connection to a specific namespace on the WebSocket server (ws-server).
| Namespace | Active | Client Class | Description |
|---|---|---|---|
/stream-client |
ACTIVE | fc24.py |
Receives commands (new-match, etc.) and emits statistics for FC24. |
/fc25/stream-client |
ACTIVE | fc25.py |
Receives commands and emits statistics for FC25. |
/undisputed/stream-client |
ACTIVE | und.py |
Receives commands and emits statistics for Undisputed. |
/helper |
ACTIVE | fc24-gui.py |
Receives start/stop/git-pull events for FC24 Launcher. |
/fc25/helper |
ACTIVE | fc25-gui.py |
Receives start/stop/git-pull events for FC25 Launcher. |
/undisputed/helper |
ACTIVE | und-gui.py |
Receives start/stop/git-pull events for Undisputed Launcher. |
/logs |
ACTIVE | All Bots | Streams logs to a centralized server. |
#Connection Logic (Python Client)
Python bot scripts use socketio.Client to establish connections. For example, in fc25.py:
import socketio
sio = socketio.Client()
namespace = '/fc25/stream-client'
@sio.on('connect', namespace=namespace)
def on_connect():
print("Connected to WebSocket server")
@sio.on('new-match', namespace=namespace)
def on_new_match(data):
# Setup and start match
...#Security & Verification
- UUID Identifier: Every device identifies itself upon connection using its local configuration uuid:
- Emits
myidevent on connection:sio.emit('myid', {'id': DEVICE_UUID}, namespace=namespace)
- Emits
- Ping/Pong: Keep-alive ping is sent automatically by the socketio client to ensure connection persistency.