Skip to content

Streaming Events

Fabric provides real-time event streaming for all domain events — workflow execution, tenancy changes, and provider operations.

import { FabricClient } from "@fabric-platform/sdk";
const fabric = new FabricClient({ apiKey: "fab_xxx" });
await fabric.streamEvents((event) => {
console.log(event.kind, event.node_key, event.payload);
});

Events arrive as SSE with this format:

event: workflow.run.started
data: {"id":"...","kind":"workflow_run_started","run_id":"...","payload":{}}
event: workflow.node.completed
data: {"id":"...","kind":"workflow_node_completed","node_key":"generate","payload":{"output":{}}}
const result = await fabric.waitForRun("<run-id>", {
onEvent: (event) => {
console.log(`Node ${event.node_key}: ${event.kind}`);
},
});

This endpoint:

  1. Replays all existing events for the run (catch-up)
  2. Streams live events as they occur (filtered to this run)

A client connecting mid-execution receives the full event history before seeing live updates.

await fabric.streamEvents("<job-id>", (event) => {
console.log(event.kind, event.payload);
});

Same replay + live streaming behavior, filtered to the specific job.

Terminal window
wscat -c ws://localhost:3001/v1/events/ws

WebSocket delivers the same event structure as SSE, using JSON messages.

EventDescription
workflow.run.createdRun was created
workflow.run.startedExecutor began processing
workflow.run.completedAll nodes completed successfully
workflow.run.failedOne or more nodes failed
workflow.run.cancelledRun was cancelled
workflow.node.readyNode dependencies satisfied
workflow.node.startedNode execution began
workflow.node.completedNode finished with output
workflow.node.failedNode execution failed
workflow.node.skippedNode skipped (dependency failed or cancelled)
EventDescription
job.createdJob was created
job.startedExecutor began processing
job.completedJob finished with output
job.failedJob execution failed
EventDescription
organization.createdOrganization was created
team.createdTeam was created
membership.createdMembership was created
invitation.createdInvitation was sent
invitation.acceptedInvitation was accepted
invitation.revokedInvitation was revoked

Every event follows this structure:

{
"id": "event-uuid",
"kind": "workflow.node.completed",
"organization_id": "org-uuid or null",
"workflow_id": "wf-uuid or null",
"run_id": "run-uuid or null",
"node_key": "generate or null",
"payload": { "output": {}, "context_version": 3 },
"timestamp": "2026-03-19T12:00:00Z"
}

Fabric supports webhook delivery for events with:

  • HMAC signing — Verify event authenticity with a shared secret
  • Exponential backoff — Automatic retries on delivery failure
  • Event filtering — Subscribe to specific event types

All transports (SSE, WebSocket, webhooks) deliver the same semantic event structure.