Skip to main content
This page covers all Socket.io-based hooks exported from the SDK. The primary hook for most plugins is useSimData. The lower-level hooks (useSocket, useSimulatorData, etc.) are available when you need direct event access.

Import


useSimData

TanStack Query + Socket.io hook for real-time simulator data. Hydrates from GET /api/simulator/snapshot on mount, then subscribes to simulator:data and simulator:status events via Socket.io. Performance: Simulator data arrives at 10–20 Hz. Updates are buffered and flushed via requestAnimationFrame, aligning cache writes to the browser’s ~60 fps paint cycle. Multiple components share a single TanStack Query cache entry — there is no duplicate subscription overhead.

Signature

Parameters

SimDataSnapshot

See SimDataSnapshot for the full shape. FlightData (the nested data field) contains all simulator variables: position, speed, altitude, heading, engine data, fuel, weather, flaps, gear, and more.

Engine state

Each engine exposes raw data (engine1Firing, engine1N1, engine1N2, engine1PctRpm) and a composite boolean:
engine*On is the recommended way to check whether an engine is running. It works reliably across all aircraft types (jets, turboprops, helicopters, pistons) and both MSFS and X-Plane. The raw engine*Firing (combustion) field is still available but can produce false positives during startup/shutdown on some aircraft.

Usage


useSocket

Core Socket.io connection hook. Uses a singleton SocketManager — all consumers share a single underlying socket. The socket connects when the first subscriber mounts and disconnects one second after the last subscriber unmounts.

Signature

Usage


useSimulatorData

Raw event streaming hook. Calls your callbacks directly on each simulator:data and simulator:status event. Prefer useSimData unless you need the raw payload or must bypass TanStack Query caching.

Signature

Usage


useProtocolUrl

Receives deep link events dispatched when the OS opens a stratos:// URL while the app is running.

Signature

Usage


useNotifications

Accumulates shell notification events for the duration of the component’s lifetime.

Signature

Usage


useSystemMetrics

Streams system metrics (CPU, memory, etc.) from the shell process.

Signature

Usage