S
S
Sergey2015-10-13 10:02:06
PHP
Sergey, 2015-10-13 10:02:06

How to get old messages from nginx push stream?

In http I wrote:

push_stream_shared_memory_size          32m;
  push_stream_max_messages_stored_per_channel  2000;
  push_stream_message_ttl                       1h;
  push_stream_ping_message_interval           10s;

In location /sub and /pub
push_stream_store_messages on;
var timestamp = (new Date()).getTime(),
url = 'http://sample.ru/channel/' + channelId + '?callback=?&v=' + timestamp;

xhr.open('GET', url, true);
xhr.setRequestHeader("Etag", $this.etag);
xhr.setRequestHeader("Last-Modified", $this.time);
xhr.send();

What else does he need?! After connecting, it gives out only new messages, it simply ignores the old ones, although in the statistics you look at the messages accumulate, but you refresh the page and the chat is empty again until there are new messages.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question