http/2 ready
Powered by nginx


upgrade Nchan is the result of a complete refactoring of the Nginx HTTP Push Module codebase. Many features have been added, but a select few have also been removed:

Push Module Nchan
Storage Engine Shared Memory Shared Memory, Redis (with local shared-memory cache)
Internal Concurrency Model One shared-access mutex. Workers cannot access shared memory while another is holding the mutex lock, and the event loop is blocked while waiting for the mutex. No mutexes or blocking locks used. Each nginx worker is responsible for a shard of the channel id space. Workers communicate with each other via unix pipes (sockets) sending roughly 60-byte messages containing pointers to shared memory and metadata. The event loop is never blocked, and workers are always available to handle connections.
Horizontal Scaling No built-in features to scale across multiple Nginx instances.

Can be quickly scaled up horizontally across Nginx instances using Redis.

Subscribers Long-Poll, Interval-Poll Websocket, EventSource, Long-Poll, Interval-Poll, HTTP Chunked Transfer, HTTP Multipart/Mixed
Publishers HTTP HTTP, Websocket
Channel Multiplexing none Up to 255 channels per location
Data Persistence Persistent across nginx reloads (via SIGHUP). No persistence after nginx shutdown No persistence without Redis. * With Redis, data persists across reloads and after shutdown.

* - In-memory persistence across reloads without redis may be implemented in the future. If you want this feature, let me know.

Metadata and Debugging Support
  • Channel info for Publisher endpoint requests.
Channel Security
  • Hiding channel URL via X-Accel-Redirect
  • Disallow new channel creation by subscribers
  • Hiding channel URL via X-Accel-Redirect
  • Disallow new channel creation by subscribers
  • Upstream callback URL for publisher and subscriber authorization
Subscriber Concurrency

Broadcast, First-In, Last-In. The latter two only allow one subscriber per channel, kicking out either the newest or oldest subscribers.

Broadcast concurrency only. First-In can be replicated with nchan_max_channel_subscribers 1; . Last-In no longer supported.

Configuration Changes

The main change is that all configuration directives have been renamed from push_* to nchan_*. However, all Push Module configuration directives) are still recognized, although a few of the very rarely used ones are now ignored. You can run Nchan with your old Push Module configuration unchanged, but it's recommended that you update it.

copy, but don't plagiarise