websocket

yaoweibin edited this page Jul 13, 2012 · 8 revisions
Clone this wiki locally

Websocket

Example

tcp {

      timeout 1d;
      websocket_read_timeout 1d;
      websocket_send_timeout 1d;         

      upstream backend1 {
          server 192.168.0.1:2000;
      }

      upstream backend2 {
          server 192.168.0.2:2000;
      }

      upstream backend3 {
          server 192.168.0.3:2000;
      }

      server {
          #default block if there is no host
          listen 80 default;
          server_name foo.example.com

          websocket_pass backend1;
      }

      server {
          listen 80;
          #request from host name 'bar.example.com' 
          server_name bar.example.com

          #default process handler
          websocket_pass backend2;
          #request from path of 'cat'
          websocket_pass /cat backend3;
      }
    }