본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)19k · #10489

iii-stream

하는 일

이 스킬은 실시간 데이터를 이름 있는 스트림에 저장하고, 변경 사항을 연결된 클라이언트에 밀어 보내므로 실시간 기능에 폴링이 필요하지 않습니다. 이 워커는 지원 중단되어 제거될 예정이므로, 기존 iii 시스템을 유지보수하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓이미 스트림을 쓰는 기존 iii 시스템을 유지보수할 때.
  • ✓구독자에게 업데이트를 밀어 보내는 실시간 피드가 필요할 때.
  • ✓스트리밍 기능을 더 새로운 방식으로 옮길 계획이 있는 경우.

스킬 링크

https://github.com/iii-hq/iii/blob/main/engine/src/workers/stream/skills/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/iii-hq/iii/blob/main/engine/src/workers/stream/skills/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“기존 iii 스트림이 구독한 클라이언트에 업데이트를 어떻게 보내는지 보여 주셔서, 이전 계획을 세울 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

워커는 항목을 세 단계 구조에 저장하고, 각 변경을 그 스트림을 구독한 클라이언트에 보냅니다. 클라이언트가 들어올 때 인가 검사를 실행할 수 있습니다. 지금은 동작이 바뀌지 않았으며, 이전 안내는 문서에 연결되어 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

iii-stream

Deprecated. iii-stream is deprecated (iii-stream) and will be removed in an upcoming release. Behavior is unchanged for now. Migration guide: https://iii.dev/docs/upgrading/migrate-from-streams

The iii-stream worker stores real-time data as a three-level hierarchy (stream_name -> group_id -> item_id) in the configured adapter and exposes two surfaces: a CRUD-shaped stream::* function namespace for reading and writing items, and reactive trigger types (stream, stream:join, stream:leave) that fire on data changes and on WebSocket subscriber connect/disconnect. Reactive backends are built by binding handlers to those triggers rather than by polling.

A write persists the new value, dispatches matching stream triggers on a spawned task (fire-and-forget, so the originating call returns before handlers finish), and broadcasts the change to every WebSocket client subscribed to that (stream_name, group_id). The stream:join trigger doubles as an authorization gate: returning { unauthorized: true } from its handler rejects the subscription before any data flows. Pair it with the worker's auth_function config, which runs once per WebSocket handshake and stamps a context value into every join/leave event.

Adapters: kv (default; in-memory or file-backed; single-instance only, no cross-process fan-out) or redis (required for multi-instance fleets that need real-time fan-out). Browser and client subscriptions use the Browser SDK (iii-browser-sdk), which subscribes to stream changes over a single engine WebSocket. Connecting directly to the stream port (ws://host:{port}/stream/{stream_name}/{group_id}) is deprecated in favor of the Browser SDK.

When to Use

  • A stream change should kick off side effects elsewhere (derived projections, audit logs, notifications) without polling stream::list.
  • You need to gate WebSocket subscriptions server-side instead of trusting client-side filtering.
  • You want server-side reactions to subscriber connect/disconnect for presence counters, per-subscription rate buckets, or audit trails.
  • An item needs atomic partial updates that concurrent writers would otherwise race on.

Boundaries

  • Not a general key/value store — data is stream-shaped (stream_name/group_id/item_id). Use the standalone state worker for scope/key values.
  • The default kv adapter does not fan out across processes; multi-instance fleets that need real-time broadcast must use redis.
  • stream:leave is not an authorization gate — the subscription is already gone by the time it fires, and its return value is ignored.
  • Trigger handlers run after the originating write returns; a handler failure neither rolls back the write nor surfaces to the caller.

Functions

  • stream::set — persist an item and broadcast a create/update event; returns the previous value alongside the new one.
  • stream::update — atomically apply ordered set/merge/increment/decrement/append/remove ops to an existing item.
  • stream::delete — remove an item and broadcast a delete event carrying the removed value.
  • stream::send — broadcast a transient event to a group's subscribers without persisting it (typing indicators, cursor positions).
  • stream::get — read one item by its full (stream, group, item) triple.
  • stream::list — enumerate items in a group.
  • stream::list_groups — enumerate groups in a stream.
  • stream::list_all — enumerate every stream's metadata.

Reactive triggers

Bind a stream-family trigger when a function should run automatically on stream activity — without polling stream::list. Three types cover two concerns: stream reacts to data changes, while stream:join / stream:leave react to WebSocket subscriber lifecycle.

Reach for them when:

  • A set/update/delete/send should drive a projection, audit log, or downstream notification.
  • Subscriptions need server-side authorization (stream:join) or paired setup/teardown (stream:join + stream:leave).

If you only need the current value on demand, call stream::get instead of binding a trigger.

How to bind

  1. Register a handler: iii.registerFunction('presence::on-change', handler).
  2. Register the trigger:
iii.registerTrigger({
  type: 'stream',
  function_id: 'presence::on-change',
  config: {
    stream_name: 'presence',  // required for `stream`; the worker indexes triggers by it.
    group_id: 'room-1',       // optional. Empty/omitte
자주 묻는 질문

이 워커는 아직 지원되나요?

지원 중단되었고 곧 제거될 예정이지만, 지금은 동작이 바뀌지 않았습니다.

이전 안내서는 어디 있나요?

워커 문서가 iii 사이트의 마이그레이션 가이드로 연결됩니다.

여러 서버 프로세스에서 실행할 수 있나요?

Redis 어댑터를 쓸 때만 가능합니다. 기본 저장소는 프로세스 사이에 업데이트를 공유하지 않습니다.

상세 정보

작성자의 원본 설명

Durable real-time streams with a CRUD function surface plus reactive triggers that fire on item changes and WebSocket subscriber lifecycle — reach for it to build live backends without polling. iii-stream is deprecated (iii-stream) and will be removed in an upcoming release. Behavior is unchanged for now. Migration guide: https://iii.dev/docs/upgrading/migrate-from-streams

repo: iii-hq/iii

인기도

GitHub 스타
19k
순위
#10489
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬