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

Use of Etag #85

Closed brianwhu closed 11 years ago

brianwhu commented 11 years ago

We are trying to build a service that delivers large amounts of realtime updates to potentially tens of thousands of subscribers who connect from .NET and Java front ends using HTTP long polling. As updates come in sub-millisecond intervals the last modified time is too coarse a measure for our purpose in determining whether a subscriber has got a certain update. I suspect that use of etag alone might give us a solution.

I've done some simple tests with the sample configuration and curl and has the following discoveries.

  1. I don't seem to have a means to assign an etag to an update that I post to the push module/nginx no matter what I put in the ETag header in the POST request
  2. The long polling client always gets "ETag: 0" from nginx
  3. When seeing "If-None-Match: 0" but not "If-Modified-Since" in the header nginx returns 305 immedately instead of holding the request till the next update

Could you shed some light on these observations?

Thanks for the great work!

wandenberg commented 11 years ago

Hi Brian. The Etag is set by the module when two or more messages are published on the same second on the channel, you cannot force this header on POST. You have to send both headers when subscribing, If-None-Match and If-Modified-Since. With these headers the module will filter the messages and deliver only the new ones. Remember to set the messages_store to on.

If you have any problems with that let me know. You can also send a message to the discussion group.

Regards

brianwhu commented 11 years ago

I see... will do some more tests. Thanks for the very quick response! You are amazing.

wandenberg commented 11 years ago

Hi Brian,

How is going your tests? Can I close the issue?