Token导航 LogoToken导航TokenDH.com
开发敏感数据clawhub未标认证来源可访问clear审计通过

websocket-patterns网络套接字模式

Agent Skill

websocket-patterns 用于辅助前端页面、组件、样式和交互逻辑开发,适合在 OpenClaw 中需要维护前端项目、生成组件或检查界面实现时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,752

周安装

152

GitHub Stars

公开资料未说明

下载量

1,664
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:websocket-patterns(网络套接字模式)
来源仓库:https://github.com/codenova58/websocket-patterns
安装命令:
openclaw skills install websocket-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install websocket-patterns

简介

websocket-patterns 提供深度 WebSocket/SSE 工作流程设计,涵盖握手、心跳与背压处理。

  • 适用于实时通信系统开发、连接管理与可扩展性优化等开发任务。
  • 通过 clawhub 安装并使用 openclaw skills install websocket-patterns 命令集成。
  • 使用前需确认权限范围,注意可能涉及网络协议实现与资源占用。
  • 建议查看原始仓库以了解可观察性与错误恢复机制细节。

SKILL.md

name
websocket-patterns
description
Deep WebSocket/SSE workflow—handshake and auth, session lifecycle, heartbeats, ordering, backpressure, scaling, and observability. Use when building realtime dashboards, chat, collaborative editing, or live notifications.

WebSocket Patterns (Deep Workflow)

Realtime connections add stateful complexity: who is connected, what order messages arrive, and what happens when links flap. Design for at-least-once delivery, explicit heartbeats, and horizontal scaling early.

When to Offer This Workflow

Trigger conditions:

  • Replacing polling with WS or SSE
  • Auth on connect; token refresh mid-session
  • Fan-out to many subscribers; presence and typing indicators
  • Sticky sessions, load balancer timeouts, reconnect storms

Initial offer:

Use six stages: (1) choose transport, (2) connection & auth, (3) protocol & messages, (4) reliability & ordering, (5) scale & ops, (6) security & abuse). Confirm browser vs server clients and proxies (nginx, ALB, Cloudflare).


Stage 1: Choose Transport

Goal: WebSocket vs SSE vs long polling—right tool per direction.

Heuristics

  • Bidirectional, low latency, binary payloads → WebSocket
  • Server → client one-way streams, HTTP-friendly infra → SSE
  • Fire-and-forget notifications with simple infra → consider push services first

Caveats

  • Corporate proxies historically hurt WS—test environments; WSS mandatory
  • HTTP/3 QUIC stacks differ—validate intermediaries

Exit condition: Transport choice documented with why not alternatives.


Stage 2: Connection & Auth

Goal: Authenticated sockets without long-lived secrets in query strings when avoidable.

Patterns

  • JWT in Sec-WebSocket-Protocol or first message after connect—prefer short-lived tokens + refresh flow
  • Cookie sessions with CSRF considerations on same-site policies
  • Re-auth before token expiry; graceful close with code and reason

Authorization

  • Subscribe to topics only after server-side check—never trust client channel names alone

Exit condition: Auth diagram: issue token → connect → authorize subscriptions.


Stage 3: Protocol & Messages

Goal: Versioned message schema; predictable errors.

Design

  • Envelope: { type, id, ts, payload }; correlation ids for RPC-style
  • Version negotiation on connect or feature flags in hello message
  • Binary vs JSON—protobuf/msgpack for bandwidth; JSON for debuggability early

Heartbeats

  • Ping/pong or application-level heartbeat at interval < proxy timeout (often 30–60s)
  • Idle detection and clean disconnect

Exit condition: Protocol doc + example session transcript.


Stage 4: Reliability & Ordering

Goal: Define delivery semantics—usually at-least-once over TCP; ordering per channel.

Practices

  • Idempotent message handlers; dedupe by message id when retries exist
  • Per-user sequence numbers if strict order matters
  • Buffer limits: drop, close, or apply backpressure policy

Reconnect

  • Exponential backoff + jitter to prevent thundering herd
  • Resume from last seen seq if missed messages are unacceptable—persist or snapshot

Exit condition: Reconnect story documented; storm mitigation tested.


Stage 5: Scale & Operations

Goal: Many connections across many nodes—affinity and pub/sub backbone.

Architecture

  • Sticky sessions or shared pub/sub (Redis, NATS, Kafka) for cross-node fan-out
  • Shard connection maps; avoid single giant in-memory map on one box

Observability

  • Metrics: active connections, msg/sec, queue depth, disconnect reasons
  • Tracing: connect → subscribe → first message latency

Load shedding

  • Max connections per IP/user; rate limit connection attempts

Exit condition: Capacity model: connections per node × message fan-out cost.


Stage 6: Security & Abuse

Goal: Minimize attack surface on long-lived pipes.

Controls

  • WSS everywhere; validate Origin where applicable
  • Payload size limits; compression bomb awareness
  • AuthZ on every subscription; audit admin actions

Abuse

  • Spam detection; kick/ban flows; circuit breakers on misbehaving clients

Final Review Checklist

  • [ ] Transport choice justified (WS/SSE/etc.)
  • [ ] AuthN/Z on connect and per-channel
  • [ ] Heartbeats aligned with proxy/LB timeouts
  • [ ] Delivery/idempotency/reconnect semantics explicit
  • [ ] Horizontal scale path + observability + abuse controls

Tips for Effective Guidance

  • ALB idle timeout vs heartbeat—classic production bug; call it out.
  • When user says “real-time,” ask latency target and ordering needs.
  • SSE is simpler—don’t default to WS for one-way feeds.

Handling Deviations

  • Edge runtimes (Workers): different connection limits and duration—validate platform.
  • Mobile: background suspensionpush notifications may complement WS.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

80.32%
按下载量换算1,337

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills