首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

运用Nginx的NHPM模块和jQuery进行的Comet测试

2012-10-29 
使用Nginx的NHPM模块和jQuery进行的Comet测试原文在这里:http://blog.jamieisaacs.com/2010/08/27/comet-w

使用Nginx的NHPM模块和jQuery进行的Comet测试
原文在这里:http://blog.jamieisaacs.com/2010/08/27/comet-with-nginx-and-jquery/
一直很想了解Comet的实现,正好看见了上面的这个文章,就装了个CentOS做了一下实验,过程如下:
1、下载软件和安装
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    server {
    listen  81;
    server_name localhost;

    root /var/www/localhost;

    location /cheetah {
        push_channel_group pushmodule_cheetah;
        location /cheetah/pub {
            set $push_channel_id cheetah;
            push_publisher;
            push_message_timeout 5s;        # Give the clients time
            push_message_buffer_length 10;  # to catch up
        }
        location /cheetah/sub {
            set $push_channel_id cheetah;
            push_subscriber;
            send_timeout 3600;
        }
    }
    }
}

启动nginx

listen.html


大功告成,只要在send.html里面输入内容并发送,listen.html就会接收到信息

热点排行