Agent skill

iii-realtime-streams

Pushes live updates to connected WebSocket clients via streams. Use when building real-time dashboards, live feeds, or collaborative features.

Stars 15,297
Forks 1,022

Install this agent skill to your Project

npx add-skill https://github.com/iii-hq/iii/tree/main/skills/iii-realtime-streams

SKILL.md

Realtime Streams

Comparable to: Socket.io, Pusher, Firebase Realtime

Key Concepts

Use the concepts below when they fit the task. Not every stream setup needs all of them.

  • iii-stream serves WebSocket connections on the configured stream port (default 3112)
  • Clients connect at ws://host:{stream_port}/stream/{stream_name}/{group_id}
  • stream::set / stream::get / stream::list / stream::delete provide CRUD for stream items
  • stream::send pushes events to all connected clients in a stream group
  • createStream registers a custom adapter for non-default stream backends
  • Each stream item is identified by stream_name, group_id, and item_id; data is the item payload

Architecture

Function
  → trigger('stream::set', { stream_name, group_id, item_id, data })
  → trigger('stream::send', { stream_name, group_id, data })
    → iii-stream
      → WebSocket push
        → Connected clients at /stream/{stream_name}/{group_id}

iii Primitives Used

Primitive Purpose
trigger({ function_id: 'stream::set', payload }) Create or update a stream item
trigger({ function_id: 'stream::get', payload }) Read a stream item
trigger({ function_id: 'stream::list', payload }) List items in a stream group
trigger({ function_id: 'stream::delete', payload }) Remove a stream item
trigger({ function_id: 'stream::send', payload }) Push an event to connected clients
createStream Register a custom stream adapter

Reference Implementation

See ../references/realtime-streams.js for the full working example — a stream that pushes live updates to WebSocket clients and manages stream items with CRUD operations.

Also available in Python: ../references/realtime-streams.py

Also available in Rust: ../references/realtime-streams.rs

Common Patterns

Code using this pattern commonly includes, when relevant:

  • registerWorker(url, { workerName }) — worker initialization
  • trigger({ function_id: 'stream::set', payload: { stream_name, group_id, item_id, data } }) — write stream item
  • trigger({ function_id: 'stream::send', payload: { stream_name, group_id, data } }) — push event to clients
  • trigger({ function_id: 'stream::get', payload: { stream_name, group_id, item_id } }) — read stream item
  • trigger({ function_id: 'stream::list', payload: { stream_name, group_id } }) — list items in group
  • createStream(name, adapter) — custom adapter for specialized backends

Browser Clients

For browser-side WebSocket connections, use iii-browser-sdk instead of the Node SDK. See iii-browser-sdk skill for setup details. Stream authentication via literals is supported.

Adapting This Pattern

Use the adaptations below when they apply to the task.

  • Name streams after your domain (e.g. chat-messages, dashboard-metrics, notifications)
  • Use group_id to partition streams per user, room, or tenant
  • Combine with iii-state-reactions to push a stream event whenever state changes
  • Use createStream when the default adapter does not fit (e.g. custom persistence or fan-out logic)

Engine Configuration

iii-stream must be enabled in iii-config.yaml with a port and adapter (KvStore or Redis). See ../references/iii-config.yaml for the full annotated config reference.

Pattern Boundaries

  • If the task is about persistent key-value data without real-time push, prefer iii-state-management.
  • If the task needs reactive triggers on state changes (server-side), prefer iii-state-reactions.
  • Stay with iii-realtime-streams when the primary need is pushing live updates to connected clients.

When to Use

  • Use this skill when the task is primarily about iii-realtime-streams in the iii engine.
  • Triggers when the request directly asks for this pattern or an equivalent implementation.

Boundaries

  • Never use this skill as a generic fallback for unrelated tasks.
  • You must not apply this skill when a more specific iii skill is a better fit.
  • Always verify environment and safety constraints before applying examples from this skill.

Expand your agent's capabilities with these related and highly-rated skills.

iii-hq/iii

iii-dead-letter-queues

Inspects and redrives jobs that exhausted all retries. Use when handling failed queue jobs, debugging processing errors, or implementing retry strategies.

15,297 1,022
Explore
iii-hq/iii

iii-cron-scheduling

Registers cron triggers with 7-field expressions to run functions on recurring schedules. Use when scheduling periodic jobs, timed automation, crontab replacements, cleanup routines, report generation, health checks, batch processing, or any task that should run every N seconds, minutes, hours, or on a weekly/monthly calendar.

15,297 1,022
Explore
iii-hq/iii

iii-http-invoked-functions

Registers external HTTP endpoints as iii functions using registerFunction(id, HttpInvocationConfig). Use when adapting legacy APIs, third-party webhooks, or immutable services into triggerable iii functions, especially when prompts ask for endpoint maps like { path, id } iterated into registerFunction calls.

15,297 1,022
Explore
iii-hq/iii

iii-channels

Binary streaming between workers via channels. Use when building data pipelines, file transfers, streaming responses, or any pattern requiring binary data transfer between functions.

15,297 1,022
Explore
iii-hq/iii

iii-event-driven-cqrs

Implements CQRS with event sourcing on the iii engine. Use when building command/query separation, event-sourced systems, or fan-out architectures where commands publish domain events and multiple read model projections subscribe independently.

15,297 1,022
Explore
iii-hq/iii

iii-agentic-backend

Creates and orchestrates multi-agent pipelines on the iii engine. Use when building AI agent collaboration, agent orchestration, research/review/synthesis chains, or any system where specialized agents hand off work through queues and shared state.

15,297 1,022
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results