wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

message sending in ie6 and ie7 taken long time #55

Closed pokal4u closed 11 years ago

pokal4u commented 11 years ago

Hi,

In IE6 and IE7 message sending taken long time,

but receiving messages immediately.

in other browsers work fine.

Please help me.

Thanks

wandenberg commented 11 years ago

Hi,

how are you measuring this time? how much is the time difference from IE6 and other browsers? how is the configuration you are using? polling or stream?

I did some tests here and the sending time is almost the same on all browsers I used (take a look on the values before status code 200), 1ms at the mean.

do you really need to support those browsers? :)

Anyway, I don't have any difference on the code regarding browsers, only if you set to use some padding, what isn't necessary for IEs browsers.

[20/Nov/2012:15:10:46 -0200] POST /pub?id=example&_=1353431446778 HTTP/1.1 [0.000] 200 95 http://192.168.254.5:9080/examples/chat_longpolling.html Mozilla/5.0 (X11; Ubuntu; Linux x8664; rv:16.0) Gecko/20100101 Firefox/16.0 [20/Nov/2012:15:11:13 -0200] POST /pub?id=example&=1353431473470 HTTP/1.1 [0.001] 200 95 http://192.168.254.5:9080/examples/chat_longpolling.html Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) [20/Nov/2012:15:12:32 -0200] POST /pub?id=example&_=1353431552484 HTTP/1.1 [0.001] 200 95 http://192.168.254.5:9080/examples/chat_longpolling.html Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1) [20/Nov/2012:15:13:20 -0200] POST /pub?id=example&_=1353431600823 HTTP/1.1 [0.000] 200 95 http://192.168.254.5:9080/examples/chat_longpolling.html Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1)

pokal4u commented 11 years ago

Hi, Thanks for reply

I am facing same problem till now in ie6 and ie7

and gzip not working (in yslow any js/css file shows afetr gzip same size )

and i am using fastcgi module please check for fastcgi configuration in config file

I am using long pooling.

my config file like this:

pid logs/nginx.pid; error_log logs/nginx-main_error.log debug;

Development Mode

master_process off; daemon off; worker_rlimit_core 500M; working_directory /tmp/nginx;

worker_processes 2;

events { worker_connections 1024; use epoll; }

http {

index index.php index.htm index.html .php;
include         /usr/local/nginx/conf/mime.types;
default_type    application/octet-stream;

access_log      logs/nginx-http_access.log;
error_log       logs/nginx-http_error.log debug;    

tcp_nopush                      off;
tcp_nodelay                     on;
keepalive_timeout               10;
send_timeout                    10;
client_body_timeout             10;
client_header_timeout           10;
sendfile                        on;
client_header_buffer_size       1k;
large_client_header_buffers     2 4k;
#client_max_body_size            1k;
#client_body_buffer_size         1k;
ignore_invalid_headers          on;

push_stream_shared_memory_size              500m;
push_stream_max_channel_id_length           200;
# max messages to store in memory
push_stream_max_messages_stored_per_channel  1000;
# message ttl
push_stream_message_ttl                      5m;
# ping frequency
push_stream_ping_message_interval           10s;
# connection ttl to enable recycle
push_stream_subscriber_connection_ttl        15m;
# connection ttl for long polling
push_stream_longpolling_connection_ttl        5m;
# broadcast
push_stream_broadcast_channel_prefix        "broad_";

#push_stream_message_template                "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\",\"eventid\":\"~event-id~\"}";
push_stream_message_template                "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";

# subscriber may create channels on demand or only authorized
# (publisher) may do it?
push_stream_authorized_channels_only        off;
push_stream_broadcast_channel_max_qtd       3;

client_max_body_size                    3M;
client_body_buffer_size                 3M;

server {
    listen           80 default_server;
    #listen          9443 ssl;
    #ssl_certificate     /usr/local/nginx/ssl/server.crt;
    #ssl_certificate_key /usr/local/nginx/ssl/server.key;
    server_name     localhost;  
# Compression
gzip on;
gzip_vary on;
gzip_min_length  1100;
gzip_comp_level 1;
gzip_http_version 1.0;
gzip_proxied any;
gzip_disable "msie6";
gzip_types  text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    proxy_set_header Host $host;        
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Accept-Encoding gzip,deflate; 

    location ~* \.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)?$ {
      expires 1M;
      #access_log off;
      add_header Cache-Control "public";
      add_header Cache-Control "must-revalidate";

    }       

    location /channels-stats {
        # activate channels statistics mode for this location
        push_stream_channels_statistics;

        # query string based channel id
        set $push_stream_channel_id             $arg_id;
    }

    location @backend {
      internal;
      proxy_pass http://localhost:8080;       
      #include proxy.inc; # Refer step 9
    }

    location ~ .*\.(php|jsp|cgi|pl|py|dat)?$ {
      proxy_pass http://localhost:8080;       
      #include proxy.inc; # Refer step 9       
    }

    location ~ \.php$ {
        include /usr/local/nginx/conf/fastcgi_params;
        fastcgi_pass localhost:8080;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/html$fastcgi_script_name;
        fastcgi_param HTTPS on;         
    }       

    location /pub {
        # activate publisher mode for this location, with admin support
        push_stream_publisher admin;

        # query string based channel id
        set $push_stream_channel_id             $arg_id;

        # store messages in memory
        push_stream_store_messages              on;

        push_stream_keepalive                   on;

        # Message size limit
        # client_max_body_size MUST be equal to client_body_buffer_size or
        # you will be sorry.
        #client_max_body_size                    32k;
        #client_body_buffer_size                 32k;
    }

    location ~ /sub/(.*) {
        # activate subscriber mode for this location
        push_stream_subscriber;

        # positional channel path
        set $push_stream_channels_path              $1;

        # header to be sent when receiving new subscriber connection
        push_stream_header_template                 "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-store\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\r\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\r\n<meta http-equiv=\"Expires\" content=\"Thu, 1 Jan 1970 00:00:00 GMT\">\r\n<script type=\"text/javascript\">\r\nwindow.onError = null;\r\ntry{ document.domain = (window.location.hostname.match(/^(\d{1,3}\.){3}\d{1,3}$/)) ? window.location.hostname : window.location.hostname.split('.').slice(-2).join('.');}catch(e){}\r\nparent.PushStream.register(this);\r\n</script>\r\n</head>\r\n<body>";
        # message template
        #push_stream_message_template                "<script>p(~id~,'~channel~','~text~','~event-id~');</script>";
        push_stream_message_template                "<script>p(~id~,'~channel~','~text~');</script>";
        # footer to be sent when finishing subscriber connection
        push_stream_footer_template                 "</body></html>";
        # content-type
        push_stream_content_type                    "text/html; charset=utf-8";
    }

    location ~ /ev/(.*) {
        # activate subscriber mode for this location
        push_stream_subscriber;

        # positional channel path
        set $push_stream_channels_path              $1;

        # activate event source support for this location
        push_stream_eventsource_support on;
    }

    location ~ /lp/(.*) {
        # activate long-polling mode for this location
        push_stream_subscriber      long-polling;

        # positional channel path
        set $push_stream_channels_path    $1;
    }

    location ~ /ws/(.*) {
        # activate websocket mode for this location
        push_stream_websocket;

        # positional channel path
        set $push_stream_channels_path              $1;

        # store messages in memory
        push_stream_store_messages              on;

        push_stream_websocket_allow_publish     on;
    }

}   

}

Please help me

wandenberg commented 11 years ago

Hi,

this problem with ie6 and ie7 still happening? If yes, send me your javascript code, or a small example where the problem occur.