Closed pattist closed 10 years ago
Hi @pattist
as you set push_stream_authorized_channels_only to on, the subscriber is only allowed to connect in a preexisting channel with at least one message. And as you set push_stream_message_ttl to 5m, when has elapsed 5m since the last published message the server will not accept subscribers to this channel. But the channel will completely disappear from your server only after 1 hour, since you set the push_stream_channel_inactivity_time to 3600s.
The behavior is as expected/designed for.
This was done to be possible to "terminate a subject". If no one is publishing a message to a channel, so this topic can be considered as finished. And to be possible collect the memory used by this channel we can't allow new connections.
I hope this info helps you.
Hi @wandenberg
Thanks for the quick response.
I didn't understand the use and interaction of the 'ttl' and 'inactivity' timers. I think the solution for me is to send 'keepalive' messages from the publisher side, which are ignored by the client.
My application is long lived, but the messages can be infrequent or they can be high volume depending on activity in an external server application. Messages older than 5 minutes are not useful to the client and if nothing happens within an hour then there probably has been a failure in an external app or the publisher app. I set the 1 hour mainly as a way for nginx-pushstream to recover resources on an unexpected failure.
You can set the message ttl with a greater value, like 30 minutes and configure your client with secondsAgo: 300 with that when a new subscriber connect for the first time it will get only messages published with less than 5 minutes, but will allow users connect to the channel for more time. Only blocking the access if there was more than 30 minutes without a published message
Thanks for the help
Pushstream is a great nginx module, really helpful.
However, I am having a problem with the 0.4 version: My application starts up correctly It receives all initial messages posted to the pushstream by a backend & displays them But... after a while, the pushstream longpolling client will begin receiving '403 forbidden' from the nginx pushstream server with an extended reason code of "X-Nginx-PushStream-Explain: Subscriber could not create channels." However, using curl 'http://localhost:6821/channels-stats?id=ALL*', nginx still thinks the channel is up and active, but it is issuing 403 to the longpolling subscriber.
Any ideas? Thanks for any help.
nginx config and subscriber javascript below.
NGINX Config
user root; worker_processes 1; worker_rlimit_core 500m; working_directory /var/log/nginx; error_log /var/log/nginx/error.log debug;
events { worker_connections 1024; }
http {
}
}
javascript for pushstream