Back to Developer Portal

Event Streams & WebSockets

Stream real-time console log output and monitor instance state changes using WebSocket connections and REST endpoints.

1. WebSocket Live Console Stream

Connect to ws://localhost:25580/ws/instances/{id}/console to stream stdout/stderr lines and send stdin commands:

const ws = new WebSocket('ws://localhost:25580/ws/instances/paper-121/console');

ws.onmessage = (event) => {
  const logLine = JSON.parse(event.data);
  console.log('[Minecraft Console]', logLine);
};

// Send command to server stdin
ws.send(JSON.stringify({ command: 'say Hello from WebSocket client' }));

2. System & Instance Status Polling

Query health and active instance states via standard REST endpoints:

GET /health Daemon uptime, memory usage, and host OS metadata.
GET /api/status Overall service health, active server counts, and remote control settings.
GET /api/instances Real-time status, engine versions, and running state for all local servers.