wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Getting a list of open channels #18

Closed rakeshpai closed 12 years ago

rakeshpai commented 12 years ago

My use-case is of a group-chat app, where users send messages by making regular HTTP posts to my app, and subscribe to a push-stream at nginx using this module.

Since channels are client-initiated, the server app behind nginx isn't aware of which channels are currently subscribed to. Without this knowledge, the app isn't aware of which streams to publish to. In my app, I currently fix this by guessing which channels are possibly subscribed to, and publishing to all of them. This is tremendously wasteful, since I always have to over-estimate which channels are subscribed to.

I can think of some approaches to fix this:

  1. push_stream_channels_statistics (or something) can make a document available of the currently subscribed-to channels. This may be the easiest to implement.
  2. Nginx can make web-hook style calls (or use push stream itself!) to notify the app about channels that are open, and maybe raise events about when new channels are created or deleted.

Or do I have this all wrong, and this module either makes this data available in some way, or I can take some other approach to know about the currently connected channels?

rakeshpai commented 12 years ago

You know how when you have hunted for a feature that you think is an obvious omission, and you type out a whole issue with suggestions about how to fix it and stuff, and then the first thing do after that is discover the feature itself? I just had that facepalm moment.

For people who come by here later, you can simply hit http://localhost/channels-stats?id=ALL in the examples in the readme.

Sorry for the bother, @wandenberg. Thanks for the great piece of software.