Skip to main content
The Stratos Plugin SDK provides a set of React hooks that give plugin components access to real-time flight data, shell services, and socket communication. All hooks must be called inside a component tree wrapped by the shell’s PluginShellProvider.

Categories

Core

HookDescription
usePluginContextAccess the full plugin UI context (auth, config, socket, navigation, toast)

Flight Data

HookDescription
useSimDataTanStack Query + Socket.io hook for RAF-throttled real-time simulator data
useFlightPhaseTrack the current flight phase with optional field selector
useFlightEventsAccess the live flight event log with comment mutations
useLandingAnalysisLanding rate, bounce count, touchdown data, and settled analysis

Flight Management

HookDescription
useFlightManagerLow-level flight lifecycle control (start, pause, resume, end)
useTrackingSessionHigh-level convenience hook combining flight state + derived metadata

Shell Integration

HookDescription
useShellAuthRead authentication state (isAuthenticated, token, user)
useShellConfigRead plugin-namespaced config values synchronously
useShellNavigationNavigate within and between plugins and shell routes
useShellToastTrigger success, error, warning, and info toast notifications
usePluginLoggerScoped logger that routes to the shell’s logging infrastructure

Socket & Real-Time

HookDescription
useSocketCore Socket.io connection singleton with connection state
useSimulatorDataRaw event streaming for simulator data and status
useProtocolUrlDeep link events via the stratos:// protocol handler
useNotificationsShell notification events
useSystemMetricsSystem metrics streaming (CPU, memory, etc.)

Import

All hooks are exported from the SDK root:
import {
  usePluginContext,
  useSimData,
  useFlightPhase,
  useFlightEvents,
  useFlightManager,
  useTrackingSession,
  useLandingAnalysis,
  useShellAuth,
  useShellConfig,
  useShellNavigation,
  useShellToast,
  usePluginLogger,
  useSocket,
  useSimulatorData,
  useProtocolUrl,
  useNotifications,
  useSystemMetrics,
} from "@skyvexsoftware/stratos-sdk";

Common Patterns

Selecting a subset of data

Most data hooks accept a select option. The component only re-renders when the selected value changes — not on every simulator tick.
const { data: altitude } = useSimData({
  select: (s) => s?.data?.altitude ?? 0,
});

Combining hooks

Hooks are designed to be composed. useTrackingSession is the most ergonomic entry point for tracking-aware plugins; reach for lower-level hooks only when you need finer control.
function MyPlugin() {
  const { isTracking, phase, currentFlight } = useTrackingSession();
  const { landingRate } = useLandingAnalysis();
  const toast = useShellToast();
  // ...
}