WebSocket Console
Servers
WebSocket Console
Establish a WebSocket connection to the server console for real-time interaction
GET
WebSocket Console
Retrieve WebSocket credentials to connect to a server’s console. This endpoint returns a JWT token and WebSocket URL that can be used to establish a real-time connection to the server’s console output and input.
Authentication
Requires a valid session token and thewebsocket.connect permission on the specified server.
Path Parameters
Server identifier (short identifier or UUID)
Response
Success Response
JWT authentication token for the WebSocket connection. This token is valid for 15 minutes (900 seconds).
WebSocket URL to connect to. The URL format is:
wss://for HTTPS nodesws://for HTTP nodes
wss://node.example.com:8080/api/servers/{uuid}/wsUnavailable Response
If the server is not available on the Wings node, an alternative response structure is returned:Set to
true when the server is unavailableHuman-readable explanation of why the server is unavailable
Diagnostic information for troubleshooting
Example Request
Example Success Response
Example Unavailable Response
Using the WebSocket Connection
Once you have the token and socket URL, you can establish a WebSocket connection:WebSocket Events
The WebSocket connection supports various event types:Incoming Events (Server to Client)
- console output - Real-time console output from the server
- stats - Server resource statistics (CPU, memory, disk, network)
- status - Server status changes (starting, running, stopping, offline)
- daemon message - Messages from the Wings daemon
Outgoing Events (Client to Server)
- send command - Execute a command on the server console
- send logs - Request historical console logs
- set state - Request a power state change
Token Expiration
The JWT token is valid for 15 minutes (900 seconds). After expiration, the WebSocket connection will be terminated, and you’ll need to request a new token.The token includes full permissions (
["*"]) to allow the WebSocket client to interact with all server functions through the console connection.Error Responses
Missing or invalid server identifier
User lacks
websocket.connect permissionServer not found or user does not have access
Node configuration error
Failed to prepare WebSocket session with Wings daemon
Security Considerations
- Tokens are signed using the Wings node’s token secret
- Each token is tied to a specific user and server
- Tokens automatically expire after 15 minutes
- The connection is identified by a combination of user ID and server UUID
- All WebSocket activity can be monitored and logged by administrators