realtime-collaborative
Engineering patterns for building multiplayer, real-time sync, and collaborative applications using WebSockets, WebRTC, and CRDTs.
소스 정보
- 저장소
- skeletorflet/opencode-kit
- 최근 소스 활동
- 2026년 4월 1일 13:09
- 감지된 SKILL.md 언어
- 영어
- 스타
- 9
- 포크
- 1
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SKILL.md 표시 중
SKILL.md
소스 지침 · 읽기 전용 미리보기- name
- realtime-collaborative
- description
- Engineering patterns for building multiplayer, real-time sync, and collaborative applications using WebSockets, WebRTC, and CRDTs.
# Realtime Collaborative Patterns
This skill applies to applications that require instant state synchronization across multiple clients, such as collaborative document editors, live dashboards, or chat applications.
## 1. Conflict-Free Replicated Data Types (CRDTs)
When building collaborative editors (text, canvas, standard fields), use CRDTs to prevent race conditions instead of standard Operational Transformation (OT).
- **Recommended Libraries:** `Yjs`, `Automerge`, or `Liveblocks`.
- **Implementation Rules:** Ensure the source of truth is the CRDT instance, with UI components binding to the CRDT observer methods, not standard local state.
## 2. Scaling WebSockets
For applications requiring massive real-time concurrency:
- **Stateless Services:** Keep WebSocket gateways completely stateless. Push connection state to standard Redis (PubSub) or equivalent managed event busses.
- **Broadcasting:** Target broadcasts to specific channels or namespaces (e.g., `room-id:1234`) to minimize unnecessary client traffic.
- **Heartbeats:** Always implement a rigorous ping/pong heartbeat interval (e.g., 30s) to prune broken, un-closed TCP connections.
## 3. Optimistic UI Updates
Users should feel zero latency.
- Provide immediate UI feedback by locally applying mutations the instant the user interacts.
- Store the original state before the mutation.
- Fire the asynchronous request to the server/socket.
- **Rollback:** If the socket responds with an error, silently revert the UI component state back to the original payload via your state manager.
## 4. Presence and Awareness
- Abstract User Cursors and "User is Typing" features into an `awareness` protocol distinct from your data layer. This traffic runs frequently (often every few ms) and should not clutter persistence databases.
GitHub에서 보기