Portal Community

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

1

Execution Starts

Client calls POST /execute, receives executionId. Then calls useExecutionSignalR(executionId) to establish the WebSocket.

2

WebSocket Connected

SignalR negotiates the transport (WebSocket preferred, then Server-Sent Events, then Long-Polling). Connects to /hubs/execution.

3

Group Subscription

Client joins the group execution-{executionId} on the hub. Only events for this execution are received.

4

Events Stream In

As nodes execute, the backend emits events to the group. The client routes them to designerModeStore for UI updates.

5

Execution Ends

WorkflowExecutionCompleted event arrives. Client disconnects from the hub and cleans up subscriptions.

Key Hooks

HookPurpose
useExecutionSignalR(executionId)Manages WebSocket lifecycle — connect, subscribe, disconnect
useNodeExecutionSyncRoutes SignalR events to designerModeStore.setNodeStatus()
useExecutionPolling(executionId)Fallback: polls REST API every 2s when WebSocket unavailable