Skip to content

Instantly share code, notes, and snippets.

@jacobb
Created December 15, 2009 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobb/256615 to your computer and use it in GitHub Desktop.
Save jacobb/256615 to your computer and use it in GitHub Desktop.
# internal publish endpoint (keep it private / protected)
location /publish {
set $push_channel_id $arg_id; #/?id=239aff3 or somesuch
push_publisher;
push_store_messages on; # enable message queueing
push_message_timeout 2h; # expire buffered messages after 2 hours
push_max_message_buffer_length 10; # store 10 messages
push_min_message_recipients 0; # minimum recipients before purge
}
# public long-polling endpoint
location /activity {
push_subscriber;
# how multiple listener requests to the same channel id are handled
# - last: only the most recent listener request is kept, 409 for others.
# - first: only the oldest listener request is kept, 409 for others.
# - broadcast: any number of listener requests may be long-polling.
push_subscriber_concurrency broadcast;
set $push_channel_id $arg_id;
default_type text/plain;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment