DocumentationAPI Reference

WebSocket

Get WebSocket token for real-time console connection.

GET/servers/:id/websocket

Get WebSocket credentials. Token and URL for real-time console connection.

curl "https://www.mado-hosting.com/api/v1/servers/srv_abc123/websocket" \
  -H "Authorization: Bearer rsk_your_key"

WebSocket Protocol

After connecting, an auth event must be sent first. Then you receive console output and status events.

EventDirectionDescription
auth→ ServerAuthenticate with token
auth success← ServerAuthentication successful
console output← ServerConsole output line
status← ServerServer status change (running, offline, etc.)
stats← ServerReal-time resources (CPU, RAM)
send command→ ServerSend console command
set state→ ServerPower action (start, stop, restart, kill)
Not available when server is suspended (SUSPENDED). Returns 403 SERVER_SUSPENDED.