1. 介绍
// 官方说明
Nchan is a scalable, flexible pub/sub server for the modern web, built as a module for the Nginx web server. It can be configured as a standalone server,
or as a shim between your application and hundreds, thousands, or millions of live subscribers. It can buffer messages in memory, on-disk, or via Redis.
All connections are handled asynchronously and distributed among any number of worker processes. It can also scale to many Nginx servers with Redis.
Messages are published to channels with HTTP POST requests or Websocket, and subscribed also through Websocket, long-polling, EventSource (SSE), old-fashioned
interval polling, and more.
In a web browser, you can use Websocket or EventSource natively, or the NchanSubscriber.js wrapper library. It supports Long-Polling, EventSource,
and resumable Websockets, and has a few other added convenience options. It's also available on NPM.
2. 特性
RESTful, HTTP-native API.
Supports Websocket, EventSource (Server-Sent Events), Long-Polling and other HTTP-based subscribers.
Per-channel configurable message buffers with no-repeat, no-loss message delivery guarantees.
Subscribe to hundreds of channels over a single subscriber connection.
HTTP request callbacks and hooks for easy integration.
Introspection with channel events and url for monitoring performance statistics.
Channel group usage accounting and limits.
Fast, nonblocking shared-memory local message storage and optional, slower, persistent storage with Redis.
Horizontally scalable (using Redis).
Auto-failover and high availability with no single point of failure using Redis Cluster.
3. 类似nginx module
4. 集群扩展