websocket-realtime

websocket-realtime is a skill for Claude Code, Codex from nongjun/feishu-cursor-claw. It costs 54 tokens per session (542 once invoked), scanned A, original, MIT.

A FastAPI WebSocket setup for two-way, real-time communication between a server and connected clients. WebSockets keep a connection open so updates can be sent without repeated requests.

In plain words
What is it for?
Use it for live message notifications, risk alerts, streaming events, monitoring connections, and multi-user collaboration.
Why use it?
It avoids polling when users need messages or events as soon as they happen, while handling authentication, heartbeats, and reconnects.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for live message notifications, risk alerts, streaming events, monitoring connections, and multi-user collaboration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nongjun/feishu-cursor-claw/websocket-realtime
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nongjun/feishu-cursor-claw --skill websocket-realtime
Clone the repo
git clone --depth 1 https://github.com/nongjun/feishu-cursor-claw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for websocket-realtime

README.md
[![agentmods](https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/websocket-realtime.svg)](https://agentmods.dev/skills/nongjun/feishu-cursor-claw/websocket-realtime)
Your own site
<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/websocket-realtime"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/websocket-realtime.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 542 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.00542
Opus 5 $0.00027 $0.00271
Sonnet 5 $0.00011 $0.00108
Haiku 4.5 $0.00005 $0.00054

Measured 8d ago against content hash c8787ec7e10f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

websocket-realtime scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

参考代码/njcursor/skills/websocket-realtime/SKILL.md · 57 lines

What it actually says

WebSocket 实时通信

当前实现(各模块独立)

模块 管理器 特点
会话存档 ConnectionManager 按用户索引、广播新消息/风控告警
企微托管 ClientManager 服务端主动心跳、优雅断连、流式事件推送

会话存档 WebSocket

端点:/ws/messages,认证:JWT Token(Query 参数),心跳:ping/pong(60 秒超时)

方法 用途
connect(ws, metadata) 建立连接并注册
disconnect(ws) 断开并清理
send_to_user(userid, data) 定向推送
broadcast(data) 全局广播
broadcast_new_messages() 新消息通知
broadcast_risk_alert() 风控告警

企微托管 WebSocket

端点:/ws/v1/hosting/client(客户端)、/ws/v1/hosting/monitor(监控端),心跳:服务端主动发送(15 秒间隔,90 秒超时)

方法 用途
connect() 建立连接(含数据库状态同步)
disconnect() 优雅断连(先通知后关闭)
send_stream_event() 流式事件推送

SOP:新增 WebSocket 功能

  1. 参考会话存档的 ConnectionManager 模式
  2. 创建 WebSocket 路由,验证 JWT Token
  3. 实现 connect/disconnect/broadcast 等方法
  4. 前端使用 WebSocket 类封装,实现自动重连和心跳

重点关注

  • 当前未统一到公共模块,各模块独立实现
  • JWT 认证通过 Query 参数传递(WebSocket 不支持 Header)
  • 前端需实现指数退避重连策略
  • 心跳超时后服务端主动断开

参考文件

  • 会话存档/后端服务/app/websocket/init.py
  • 会话存档/后端服务/app/api/ws.py
  • 企微托管/后端服务/app/services/client_manager.py
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 57 lines · 54 tokens per session scan A c8787ec7e10f

Subscribe to this mod's changes

websocket-realtime is a skill published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It adds 54 tokens to every session and 542 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.