README.md in faye-websocket-0.5.0 vs README.md in faye-websocket-0.6.0

- old
+ new

@@ -21,11 +21,12 @@ The following web servers are supported. Other servers that implement the `rack.hjiack` API should also work. * [Goliath](http://postrank-labs.github.com/goliath/) -* [Puma](http://puma.io/) +* [Phusion Passenger](https://www.phusionpassenger.com/) >= 4.0 with nginx >= 1.4 +* [Puma](http://puma.io/) >= 2.0 * [Rainbows](http://rainbows.rubyforge.org/) * [Thin](http://code.macournoyer.com/thin/) ## Installation @@ -120,11 +121,14 @@ ws = nil end } ``` +The WebSocket client also lets you inspect the status and headers of the +handshake response via its `status` and `headers` methods. + ## Subprotocol negotiation The WebSocket protocol allows peers to select and identify the application protocol to use over the connection. On the client side, you can set which protocols the client accepts by passing a list of protocol names when you @@ -143,10 +147,29 @@ If the client and server agree on a protocol, both the client- and server-side socket objects expose the selected protocol through the `ws.protocol` property. +## Initialization options + +Both the server- and client-side classes allow an options hash to be passed in +at initialization time, for example: + +```ruby +ws = Faye::WebSocket.new(env, protocols, options) +ws = Faye::WebSocket::Client.new(url, protocols, options) +``` + +`protocols` as an array of subprotocols as described above, or `nil`. `options` +is an optional hash containing any of these keys: + +* `:headers` - a hash containing key-value pairs representing HTTP headers to + be sent during the handshake process +* `:ping` - an integer that sets how often the WebSocket should send ping + frames, measured in seconds + + ## WebSocket API Both the server- and client-side `WebSocket` objects support the following API: * <b>`on(:open) { |event| }`</b> fires when the socket connection is @@ -298,9 +321,38 @@ } server.ssl = true end } ``` + + +### Running the app with Passenger + +faye-websocket requires either Passenger for Nginx or Passenger Standalone. +Apache doesn't work well with WebSockets at this time. You do not need any +special configuration to make faye-websocket work, it should work out of the +box on Passenger provided you use at least Passenger 4.0. + +Run your app on Passenger for Nginx by creating a virtual host entry which +points to your app's "public" directory: + +``` +server { + listen 9292; + server_name yourdomain.local; + root /path-to-your-app/public; + passenger_enabled on; +} +``` + +Or run your app on Passenger Standalone: + +``` +$ passenger start -p 9292 +``` + +More information can be found on [the Passenger +website](https://www.phusionpassenger.com/support). ### Running the app with Puma Puma has a command line interface for starting your application: