Awesome-omni-skill nchan-expert
Expert guidance for Nchan, a scalable pub/sub server for Nginx. Use this skill when you need to configure Nchan endpoints (publisher/subscriber), set up horizontal scaling with Redis, implement security patterns (authorization, X-Accel-Redirect), or troubleshoot Nchan performance and metrics.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/testing-security/nchan-expert" ~/.claude/skills/diegosouzapw-awesome-omni-skill-nchan-expert-209de8 && rm -rf "$T"
manifest:
skills/testing-security/nchan-expert/SKILL.mdsource content
Nchan Expert
Overview
This skill provides procedural knowledge for configuring, optimizing, and securing Nchan, the high-performance pub/sub module for Nginx. It is based on the core Nchan documentation.
Core Capabilities
1. Endpoint Configuration
Map Nginx locations to pub/sub endpoints.
- Publishers: Use
to create endpoints that accept messages via HTTP POST or Websockets.nchan_publisher - Subscribers: Use
to support Websocket, EventSource (SSE), Long-Polling, and more.nchan_subscriber - PubSub: Use
for locations that act as both.nchan_pubsub
2. Scalability & Storage
Configure local memory storage and Redis for horizontal scaling.
- Redis Modes: Implement Distributed (shared), Backup (persistence), or Nostore (broadcast) modes.
- Redis Cluster: Set up high availability and sharding.
- See references/storage.md for implementation details.
3. Security & Access Control
Secure channels using standardized patterns:
- Authorization: Use
to delegate auth to an upstream application.nchan_authorize_request - Internal Redirects: Implement
to hide internal channel IDs.X-Accel-Redirect - ACLs: Apply standard Nginx
/allow
directives for publisher endpoints.deny - See references/security.md for patterns.
4. Advanced Messaging Features
- Multiplexing: Subscribe to up to 255 channels over a single connection.
- Channel Groups: Use
for accounting and namespace isolation.nchan_channel_group - Upstream Hooks: Use
to mutate messages before publication.nchan_publisher_upstream_request
5. Monitoring & Introspection
- Stub Status: Monitor real-time metrics via
.nchan_stub_status - Channel Events: Track channel lifecycle events for debugging.
- Variables: Utilize Nchan-specific variables like
and$nchan_channel_id
.$nchan_subscriber_count - See references/variables.md for the full reference.
6. Testing & Validation
- Verify Handshakes: Use
withcurl
and a valid 16-byte--http1.1
.Sec-WebSocket-Key - Troubleshoot: Resolve issues with HTTP/2 negotiation and strict proxy key enforcement (e.g., Cloudflare/Render).
- See references/testing.md for commands and troubleshooting steps.
7. Containerization
- Compile Module: Use multi-stage builds to compile Nchan for Nginx Alpine.
- Harden Security: Run as a non-root user and implement container healthchecks.
- See references/docker.md for the Dockerfile pattern and configuration.
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) and handshake troubleshooting.
- references/docker.md: Docker containerization and multi-stage build patterns.