# Nginx push question

**URL:** <https://www.ruby-forum.com/t/nginx-push-question/190896>\
**Category:** NGINX\
**Created:** [June 30, 2010, 10:55am UTC](https://www.ruby-forum.com/t/nginx-push-question/190896 "2010-06-30T10:55:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Baroukh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@Mike\_Baroukh](https://www.ruby-forum.com/u/Mike_Baroukh)\
**Post date:** [June 30, 2010, 10:55am UTC](https://www.ruby-forum.com/t/nginx-push-question/190896/1 "2010-06-30T10:55:36Z")

</div>

Hi.

I found the nginx\_push\_module recently and I’m trying to find if it can  
fill my needs.  
It is really fantastic when 1 user subscribe to 1 stream.

But, can someone tell me if there is a way for one user to subscribe  
with one request to many channel ?  
I don’t think because in the activity http response, there is no header  
with he channel id to distinguish responses :

GET /activity?id=2 HTTP/1.1  
User-Agent: curl/7.19.7 (x86\_64-pc-linux-gnu) libcurl/7.19.7  
OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15  
Host: 127.0.0.1:8080  
Accept: _/_

HTTP/1.1 200 OK  
Server: nginx/0.7.67  
Date: Wed, 30 Jun 2010 08:34:50 GMT  
Content-Type: application/x-www-form-urlencoded  
Content-Length: 4  
Last-Modified: Wed, 30 Jun 2010 08:34:01 GMT  
Connection: keep-alive  
Etag: 0  
Vary: If-None-Match, If-Modified-Since

test

I suppose that a header like  
Channel-id: 2  
wouldn’t be hard to add but would it be hard to allow to subscribe with  
a request like  
GET /activity?id=1&id=3&id=36…  
?

I’m trying to use nginx on a mobile application where users can  
subscribe to many, many streams.  
But I don’t wan’t, if I can, to make a channel per user and I don’t  
wan’t each user to have as many request pending as subscribed channels  
…

A channel per user would be possible but

- I must keep on server side which user subscribed to which channel
- I must handle case where users does not exist anymore to stop wasting  
time trying to send them data …

Any idea of how I can accomplish this actually ?  
Maybe I missed something ?

Thanks anyway for this module !

–

Mike Baroukh

* * *

## Cardiweb - 29 Cite d’Antin Paris IXeme +33 6 63 57 27 22 / +33 1 53 21 82 63 [http://www.cardiweb.com/](http://www.cardiweb.com/)

---

<div class="post-metadata">

**Author:** ![Mike\_Baroukh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@Mike\_Baroukh](https://www.ruby-forum.com/u/Mike_Baroukh)\
**Post date:** [June 30, 2010, 11:48am UTC](https://www.ruby-forum.com/t/nginx-push-question/190896/2 "2010-06-30T11:48:17Z")

</div>

On 30/06/2010 09:55, Mike Baroukh wrote:

> header with he channel id to distinguish responses :

Hi Mike,

The way to do this is to have two httprequests outstanding, one for each  
channel.

If you set them up with different callbacks for when a response arrives  
then the messages for each channel will flow through independently of  
the other.

Regards

Ian

---

<div class="post-metadata">

**Author:** ![Mike\_Baroukh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@Mike\_Baroukh](https://www.ruby-forum.com/u/Mike_Baroukh)\
**Post date:** [June 30, 2010, 11:57am UTC](https://www.ruby-forum.com/t/nginx-push-question/190896/3 "2010-06-30T11:57:04Z")

</div>

Hi Ian.

Thanks a lot for your response.

I knew I can do this way but as said in my question :

> I don’t wan’t each user to have as many request pending as subscribed  
> channels …

🙂

I suppose it is effectively actually the only way but I think it would  
not be hard to have something less resources consuming.  
I’ll try to look at the module but I’m not a c programmer (I only have  
Java skills).

Thanks.

Mike Baroukh

* * *

## Cardiweb - 29 Cite d’Antin Paris IXeme +33 6 63 57 27 22 / +33 1 53 21 82 63 [http://www.cardiweb.com/](http://www.cardiweb.com/)

Le 30/06/2010 11:47, Ian H. a écrit :
