Server-sent events (SSE) for tasking
The Lattice SDK now supports two new APIs that use server-sent events (SSE) for real-time task monitoring in Lattice:
- StreamTasks - For monitoring all tasks across your Lattice environment.
- StreamAsAgent - For receiving tasks assigned to specific agents.
These new features provide instant updates on task creation, status changes, and completion without the need for polling, and replace the previous polling-based approach:
- Filtering options: Focus on specific tasks using type prefix filtering.
- Heartbeat mechanism: Verify connection health with configurable heartbeat intervals.
- Comprehensive event data: Access full task details including status, description, and metadata.
- Efficient resource usage: Reduce network traffic and server load compared to polling.
StreamTasks
The StreamTasks API enables centralized monitoring of all tasks in your Lattice environment regardless of the assigned agent.
Golang
StreamAsAgent
The StreamAsAgent API replaces the previous ListenAsAgent method, allowing agents to listen for tasks assigned specifically to them using server-sent events.
For more information about task monitoring, see Operate on tasks and Listen for tasks in the Lattice SDK guide.