Best Practices for Near Real-Time Workflow Visualization

I have successfully built a workflow using Temporal that is functioning well. Now, I’m looking to implement a UI that can:

  1. Visualize workflow results in near real-time
  2. Enable interactive features like user approvals

Currently, I’m considering two potential approaches:

Option 1: Polling

  • Regularly send queries to fetch the current workflow state
  • Pros: Simple to implement
  • Cons: Potential performance overhead

Option 2: PubSub Model

  • Have the workflow publish updates to a message queue
  • Frontend subscribes to receive live updates
  • Pros: More efficient, real-time updates
  • Cons: Slightly more complex implementation

What are the recommended patterns for near real-time workflow UI interaction? Are there built-in Temporal features or best practices I might be overlooking?

Any insights or suggestions would be greatly appreciated!

I would start from (1) assuming you don’t poll too frequently for simplicity. You can always upgrade to (2) if (1) is insufficient.

Also update blocks for long time (it uses long poll behind the scene). So if UI is waiting for update result no additional polling might be required.