Nginx_http_push_module and databases

I am new to nginx and I am using nginx as comet server by nginx_http_push_module

I have two questions:

1, how can I save messages received by nginx_http_push_module to databases?

2, how can I get the list of channel listeners?

thanks ~

+2


a source to share


2 answers


1, how can I save messages received by nginx_http_push_module to databases?

You have to subscribe to the server-side channel of interest and store each message in the database as it comes in.

You can use cURL in PHP, for example, to poll a channel for a long time (you will need to set the appropriate timeout and the right caching headers: If-None-Match and If-Modified-Since).

2, how can I get the list of channel listeners?



Side note: nginx http push module protoco l is dead simple, it's not bayeux . The subscriber / listener in this module is just an active HTTP connection to the subscriber url. For example, if you use interval polling instead of long polling, you will only be considered a subscriber for a (very) short time when the connection is established.

This is why a list of channel listeners doesn't make a lot of sense with this module.

However, you can get the number of active subscribers of a channel by sending a GET request to the post URL, but I seriously doubt you could do anything about it.

+1


a source


1 - nginx does not receive any message from clients, only from your application in the publish url, which should be protected.



2 - you can implement some javascript tricks with body.onload and unloading to create a list of chat users eg.

0


a source







All Articles