Realtime (SignalR) | FlightStack
Realtime (SignalR)
Section titled “Realtime (SignalR)”FlightStack ships real-time updates over SignalR — pipeline run status, build log lines, agent heartbeats, deployment progress. The dashboard and the Flutter app both consume the same hubs.
Endpoint
Section titled “Endpoint”{baseUrl}/hub/For example: https://api.flightstack.voostack.com/hub/.
Authentication
Section titled “Authentication”Pass your access token via accessTokenFactory (Dart / TS SignalR client) — SignalR sends
it on the WebSocket handshake.
// Dart (signalr_netcore)final connection = HubConnectionBuilder() .withUrl( '$baseUrl/hub', HttpConnectionOptions( accessTokenFactory: () async => await getAccessToken(), ), ) .withAutomaticReconnect() .build();
await connection.start();// TypeScript (@microsoft/signalr)const connection = new HubConnectionBuilder() .withUrl(`${baseUrl}/hub`, { accessTokenFactory: getAccessToken }) .withAutomaticReconnect() .build();
await connection.start();Each connection inherits the user’s permissions — you only see events for resources you can already access through the REST API.
Channels & messages
Section titled “Channels & messages”Once connected, subscribe to channels by calling the corresponding Subscribe* method on
the hub. The server pushes events on the matching On* method.
Pipeline runs
Section titled “Pipeline runs”| Method | Direction | Purpose |
|---|---|---|
SubscribeToRun(runId) | C → S | Subscribe to events for one run. |
UnsubscribeFromRun(runId) | C → S | Stop receiving events for that run. |
OnRunStatus | S → C | { runId, status, jobId?, jobStatus?, timestamp } |
OnRunComplete | S → C | { runId, finalStatus, durationMs } |
Build logs
Section titled “Build logs”| Method | Direction | Purpose |
|---|---|---|
SubscribeToBuildLogs(buildId) | C → S | Subscribe to live log lines for a build. |
UnsubscribeFromBuildLogs(buildId) | C → S | Stop the stream. |
OnLogEntry | S → C | { buildId, step, level, message, timestamp } |
Agents
Section titled “Agents”| Method | Direction | Purpose |
|---|---|---|
SubscribeToAgents(orgId) | C → S | Stream agent heartbeats and state changes for an org. |
OnAgentHeartbeat | S → C | { agentId, isOnline, currentJobId?, queueDepth } |
OnAgentStateChanged | S → C | { agentId, state } (online, offline, paused) |
Deployments
Section titled “Deployments”| Method | Direction | Purpose |
|---|---|---|
SubscribeToDeployment(deploymentId) | C → S | Live status for a deployment job. |
OnDeploymentStatus | S → C | { deploymentId, status, deployedUrl?, error? } |
Reconnect behavior
Section titled “Reconnect behavior”The official SignalR clients reconnect automatically with backoff (1s → 2s → 5s → 10s → 30s). After reconnect, re-subscribe to any channels you cared about — subscriptions are connection-scoped, not session-scoped.
connection.onreconnected(() => { for (const runId of activeRuns) connection.invoke('SubscribeToRun', runId);});Backpressure
Section titled “Backpressure”For high-volume log streams the server drops oldest entries on the client buffer if you
fall more than 1,000 entries behind. If you need durable history, paginate
GET /build/{id}/logs instead.
See also
Section titled “See also”- Builds API — REST endpoints that complement live updates
- Pipelines API — for fetching post-run state
- CLI:
flightstack logs— terminal-side log tail