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

push_stream_id_template #251

Closed Kronuz closed 7 years ago

Kronuz commented 7 years ago

Could it be possible to modify the id template from nginx?

I wish I could do: push_stream_id_template "id: ~id~\n", for EventSource.

NGX_HTTP_PUSH_STREAM_EVENTSOURCE_ID_TEMPLATE is "id: ~event-id~\n", but cannot be changed and ~event-id~ is empty, but ~id~ is autogenerated by the module and would be more useful for me.

wandenberg commented 7 years ago

Hi @Kronuz you can set an event-id during the post message action using the header Event-Id. This way you can control what is the event id for your application. The ~id~can have different values in different servers (if you are using a cluster) and this can cause some troubles for EventSource since it uses the id: as a "start point" when it needs to reconnect. But if that id is not present on the other server this can make the application to loose messages.