WebSocket Events - Real-time Updates
What This Is: A live connection that streams updates as your workflow executes. URL Pattern:wss://lao-socket.studio.lyzr.ai/ws/{flow_name}/{run_name}
Why You Need This: Instead of waiting for the entire workflow to finish, you get instant notifications as each step completes, fails, or progresses. Critical for enterprise applications where users need immediate feedback.
How It Works:
- Start your workflow with run-dag API
- Immediately connect to WebSocket with the same flow_name/run_name
- Receive real-time events as each node executes
- Handle events in your application (update UI, trigger alerts, etc.)
Key Events You Care About
Event Type | When It Fires | What You Should Do | Why It Matters |
---|---|---|---|
flow_started | Workflow begins | Update UI: “Processing…” | User knows their request is being handled |
task_started | Node begins execution | Show progress: “Step 1 of 3” | Real-time progress indication |
task_completed | Node finishes | Update progress: “Step 2 of 3” | User sees continuous progress |
flow_completed | Workflow done | Process results, notify user | Handle final results immediately |
task_failed | Node fails | Handle error, maybe retry | Immediate error response, no waiting |
flow_error | Workflow fails | Show error, log for debugging | Critical failure handling |
- Immediate Response: Users see progress instantly, not after 30+ seconds
- Error Handling: Failed steps are caught immediately, not at the end
- Better UX: Real-time progress bars instead of loading spinners
- Monitoring: Operations teams get instant alerts on failures