nocobase-realtime
Skill này làm gì
Skill này hướng dẫn thiết kế cập nhật trực tiếp trong ứng dụng và plugin NocoBase 3. Skill dành cho lập trình viên muốn trang hiển thị dữ liệu mới hoặc tiến độ ngay khi nó xảy ra.
Khi nào nên dùng
- ✓Khi bạn muốn một trang tự cập nhật khi bản ghi thay đổi, không cần polling.
- ✓Khi bạn cần hiển thị tiến độ công việc hoặc thông báo cá nhân theo thời gian thực.
- ✓Khi bạn muốn truyền trực tiếp nhật ký hoặc gửi cập nhật trực tiếp qua nhiều tiến trình server.
Liên kết skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/realtime/skills/nocobase-realtime/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể làm trang đơn hàng của tôi tự cập nhật khi có đơn mới được lưu, thay vì tải lại mỗi vài giây không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI quyết định nguồn dữ liệu nào là chuẩn, sau đó thiết lập topic phía server và hook phía client. Sự kiện trực tiếp chỉ là gợi ý ngắn, và trang sẽ tải lại dữ liệu thật khi cần.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
NocoBase Realtime
Use the installed package declarations as the API authority. Applications reuse the host server service through realtimeServiceToken from @nocobase/app-server/realtime and the host browser client through @nocobase/app-client. Do not create a socket or service per component. In a source workspace, this Skill lives under packages/libs/realtime/skills/nocobase-realtime; in generated applications, package Skills are synchronized copies.
Choose the data contract first
Identify the authoritative snapshot endpoint, its access policy, the committed writes that announce changes, and how a disconnected client catches up. Realtime events are transient hints; durable business data remains in its owning service. A successful publication means broker admission, not browser processing. Prefer small invalidations containing a record ID or revision over copying protected record contents into an event.
- Read server integration for topic declaration, resource authorization, transaction boundaries, limits and distributed deployment.
- Read client integration for query correctness, coalesced refresh, readiness, errors, manual retry and cleanup.
- Read business scenarios when choosing between snapshots, cursors, progress and periodic reconciliation.
- Read verification for meaningful acceptance cases and adapter recovery tests.
Boundaries to preserve
Register topics during provider boot and release them during shutdown. Unknown topics are denied. A user topic derives the subscriber's user from the authenticated connection; publishing uses the intended recipient, never a user ID supplied as subscription authority by the browser. Resource families reuse the HTTP endpoint's policy and recheck it on delivery.
Publish only after commit. Treat a notification failure separately from an already successful write; use the domain's durable job/outbox when announcements must be retried. Never skip distributed publication because this process has no subscribers. eventId supports tracing and bounded duplicate suppression; business revisions and persisted cursors own ordering and gap recovery.
Read snapshots after the topic's onReady, including initial subscription and reconnect. Transport onOpen is too early. For TanStack Query use refreshRealtimeQueries, which waits for pre-event reads and follows them with a new read. Return the actual refresh promise to the scheduler so failures and trailing events are observed.
Remove a poll only after identifying all its producers and failure recovery. Time-based expiry, external systems without announcements, bounded initialization waits and failed best-effort publication can still require reconciliation. A healthy WebSocket alone does not prove the snapshot is fresh.
Câu hỏi thường gặp
Sự kiện trực tiếp có chứa toàn bộ dữ liệu không?
Không. Sự kiện chỉ là gợi ý ngắn, còn dữ liệu bền vững vẫn nằm trong dịch vụ thông thường của nó.
Đây có dành cho các tính năng giọng nói của OpenAI không?
Không. Skill dành cho cập nhật trực tiếp bên trong ứng dụng NocoBase.
Điều gì xảy ra khi trình duyệt bị ngắt kết nối?
Skill có đề cập đến khôi phục snapshot để trang có thể cập nhật lại sau khi kết nối lại.
Chi tiết
Mô tả gốc của tác giả
Design and implement live updates in NocoBase 3 applications and plugins using @nocobase/realtime, host client hooks and authorized server topics. Use for replacing business polling, snapshot recovery, task progress, personal notifications, streamed logs or multi-process fan-out. Not for OpenAI audio Realtime APIs.
repo: nocobase/nocobase
Độ phổ biến
- Sao GitHub
- 25k
- Vị trí xếp hạng
- #10085
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
nocobase-app-development
25kGiúp agent của bạn xây dựng trang, tuyến, dữ liệu, quyền và kiểm thử cho một ứng dụng kinh doanh NocoBase 3 hoàn chỉnh.
shadcn
25kGiúp agent của bạn tìm, thêm, sửa và tạo kiểu cho các thành phần shadcn/ui trong dự án web, dùng tài liệu chính thức và registry của chúng.
nocobase-app-plugin-development
25kGiúp agent của bạn tạo và duy trì plugin NocoBase 3 trong một ứng dụng có sẵn, gồm phần server, client, cơ sở dữ liệu và đăng ký.
nocobase-app-upgrade
25kGiúp agent của bạn nâng cấp ứng dụng NocoBase lên bản mẫu mới hơn, mang các thay đổi của mẫu vào mà vẫn giữ công việc riêng của bạn.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.