nchan-expert
4
总安装量
2
周安装量
#50927
全站排名
安装命令
npx skills add https://github.com/tailuge/nchan-expert --skill nchan-expert
Agent 安装分布
gemini-cli
2
github-copilot
2
kode
1
claude-code
1
windsurf
1
zencoder
1
Skill 文档
Nchan Expert
Overview
This skill provides procedural knowledge for configuring, optimizing, and securing Nchan, the high-performance pub/sub module for Nginx.
Core Capabilities
1. Endpoint Configuration
Nchan maps Nginx locations to pub/sub endpoints.
- Publishers: Use
nchan_publisherto create endpoints that accept messages via HTTP POST or Websockets. - Subscribers: Use
nchan_subscriberto support Websocket, EventSource (SSE), Long-Polling, and more. - PubSub: Use
nchan_pubsubfor locations that act as both.
2. Scalability & Storage
Nchan supports local memory storage and Redis for horizontal scaling.
- Redis Modes: Distributed (shared), Backup (persistence), and Nostore (broadcast).
- Redis Cluster: High availability and sharding support.
- See references/storage.md for details.
3. Security & Access Control
Secure your channels using various patterns:
- Authorization:
nchan_authorize_requestfor delegating auth to an upstream application. - Internal Redirects:
X-Accel-Redirectfor hiding channel IDs. - ACLs: Standard Nginx
allow/denyfor publisher endpoints. - See references/security.md for implementation patterns.
4. Advanced Messaging Features
- Multiplexing: Subscribe to up to 255 channels over one connection.
- Channel Groups: Use
nchan_channel_groupfor accounting and namespace isolation. - Upstream Hooks:
nchan_publisher_upstream_requestfor mutating messages before they are published.
5. Monitoring & Introspection
- Stub Status:
nchan_stub_statusfor real-time metrics. - Channel Events:
nchan_channel_events_channel_idfor debugging channel lifecycle events. - Variables: Use Nchan-specific variables like
$nchan_channel_idand$nchan_subscriber_count. - See references/variables.md for a full list.
Resources
- references/directives.md: Comprehensive list of configuration directives.
- references/variables.md: Nchan-specific Nginx variables.
- references/security.md: Security and authorization patterns.
- references/storage.md: Memory and Redis storage configuration.
- references/testing.md: Minimal testing patterns with curl (stats, pub/sub, wss).