Stream real-time console log output and monitor instance state changes using WebSocket connections and REST endpoints.
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' }));
Query health and active instance states via standard REST endpoints: