Skip to content

Commit

Permalink
renamed $push_id to $push_channel_id. still need to find a way to use…
Browse files Browse the repository at this point in the history
… $push_id as a deprecated variable.
  • Loading branch information
slact committed Oct 9, 2009
1 parent eb143fe commit dca6db8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
20 changes: 11 additions & 9 deletions README
Expand Up @@ -21,7 +21,8 @@ push_listener
context: server, location
Defines a server or location as a listener. Requests from a listener will
not be responded to until a message for the listener (identified by
$push_id) becomes available. See protocol documentation for more info.
$push_channel_id) becomes available. See protocol documentation for more
info.

push_listener_concurrency [ last | first | broadcast ]
default: last
Expand Down Expand Up @@ -73,11 +74,11 @@ push_queue_messages [ on | off ] (DEPRECATED)
see push_store_messages

Variables:
$push_id
The id associated with a push_listener or push_sender. Must be present next
to said directives.
$push_channel_id
A token uniquely identifying a channel. Must be present in the context of
the push_listener and push_sender directives.
Example:
set $push_id $arg_id #$push_id is now the url parameter "id"
set $push_channel_id $arg_id; #channel id is now the url parameter "id"

--------------------------- Example Config -----------------------------------
http {
Expand All @@ -90,7 +91,7 @@ http {
listen localhost:8089;
location / {
default_type text/plain;
set $push_id $arg_id; #/?id=239aff3 or somesuch
set $push_channel_id $arg_id; #/?id=239aff3 or somesuch
push_sender;
push_message_timeout 2h; #buffered messages expire after 2 hours
push_message_buffer_length 10; #store 10 messages.
Expand All @@ -102,7 +103,7 @@ http {
listen 8088;
location / {
default_type text/plain;
set $push_id $arg_id; #/?id=239aff3 or somesuch
set $push_channel_id $arg_id; #/?id=239aff3 or somesuch
push_listener;
}
}
Expand Down Expand Up @@ -132,6 +133,7 @@ see the file protocol.txt
---------------------------- todo --------------------------------------------
- Add other mechanisms of server pushing. The list should include
"long-poll" (default), "interval-poll".
- When POSTing to push_server, if Content-Type is "message/http", the
response sent to $push_id should be created from the body of the request.
- When POSTing to a sender location, if Content-Type is "message/http", the
response sent to $push_channel_id should be created from the body of the
request.

2 changes: 1 addition & 1 deletion src/ngx_http_push_module.c
Expand Up @@ -153,7 +153,7 @@ static ngx_int_t ngx_http_push_set_id(ngx_str_t *id, ngx_http_request_t *r, ngx_
ngx_http_variable_value_t *vv = ngx_http_get_indexed_variable(r, cf->index);
if (vv == NULL || vv->not_found || vv->len == 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"http_push module: the \"$push_id\" variable is required but is not set");
"http_push module: the \"$push_channel_id\" variable is required but is not set");
return NGX_ERROR;
}
if (id!=NULL){
Expand Down
14 changes: 7 additions & 7 deletions src/ngx_http_push_module_setup.c
Expand Up @@ -192,18 +192,18 @@ static char * ngx_http_push_merge_loc_conf(ngx_conf_t *cf, void *parent, void *c
return NGX_CONF_OK;
}

static ngx_str_t ngx_http_push_id = ngx_string("push_id"); //id variable name
static ngx_str_t ngx_http_push_channel_id = ngx_string("push_channel_id"); //channel id variable
//sender and listener handlers now.
static char *ngx_http_push_setup_handler(ngx_conf_t *cf, void * conf, ngx_int_t (*handler)(ngx_http_request_t *)) {
ngx_http_core_loc_conf_t *clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
ngx_http_push_loc_conf_t *plcf = conf;
clcf->handler = handler;
clcf->handler = handler;
clcf->if_modified_since = NGX_HTTP_IMS_OFF;
plcf->index = ngx_http_get_variable_index(cf, &ngx_http_push_id);
if (plcf->index == NGX_ERROR) {
return NGX_CONF_ERROR;
}
return NGX_CONF_OK;
plcf->index = ngx_http_get_variable_index(cf, &ngx_http_push_channel_id);
if (plcf->index == NGX_ERROR) {
return NGX_CONF_ERROR;
}
return NGX_CONF_OK;
}

static char *ngx_http_push_set_listener_concurrency(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
Expand Down

0 comments on commit dca6db8

Please sign in to comment.