SignalR Overview
Flow Studio uses ASP.NET Core SignalR to stream execution events from the backend to the browser in real time. Every node status change, log entry, and execution completion is pushed over a WebSocket connection — no polling required under normal conditions.
Why SignalR?
Workflow executions can take anywhere from milliseconds to hours. Polling for status every 2 seconds would either miss rapid state changes (for fast workflows) or create unnecessary load (for long ones). SignalR's persistent WebSocket connection delivers events exactly when they happen, with sub-100ms latency from backend event to canvas update.
Architecture Overview
Execution Starts
Client calls POST /execute, receives executionId. Then calls useExecutionSignalR(executionId) to establish the WebSocket.
WebSocket Connected
SignalR negotiates the transport (WebSocket preferred, then Server-Sent Events, then Long-Polling). Connects to /hubs/execution.
Group Subscription
Client joins the group execution-{executionId} on the hub. Only events for this execution are received.
Events Stream In
As nodes execute, the backend emits events to the group. The client routes them to designerModeStore for UI updates.
Execution Ends
WorkflowExecutionCompleted event arrives. Client disconnects from the hub and cleans up subscriptions.
Key Hooks
| Hook | Purpose |
|---|---|
useExecutionSignalR(executionId) | Manages WebSocket lifecycle — connect, subscribe, disconnect |
useNodeExecutionSync | Routes SignalR events to designerModeStore.setNodeStatus() |
useExecutionPolling(executionId) | Fallback: polls REST API every 2s when WebSocket unavailable |