<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,14 +21,22 @@ example, here's a &lt;tt&gt;config.ru&lt;/tt&gt; for running it with Sinatra:
 
   require 'rubygems'
   require 'faye'
+  require 'sinatra'
   require 'path/to/sinatra/app'
   
-  use Faye::RackAdapter, :mount =&gt; '/comet'
+  use Faye::RackAdapter, :mount   =&gt; '/comet',
+                         :timeout =&gt; 30
+  
   run Sinatra::Application
 
 This starts a Comet endpoint at &lt;tt&gt;http://localhost:9292/comet&lt;/tt&gt; with
-the client script at &lt;tt&gt;http://localhost:9292/comet.js&lt;/tt&gt;. On the client
-side, set up the client as follows:
+the client script at &lt;tt&gt;http://localhost:9292/comet.js&lt;/tt&gt;. The +timeout+
+option sets how long (in seconds) a long-polling request will wait before
+timing out; this must be less than the timeout set on your frontend web server
+so that the Comet server can send a response before Apache (for example)
+closes the connection.
+
+In your front-end code, set up the client as follows:
 
   &lt;script type=&quot;text/javascript&quot; src=&quot;/comet.js&quot;&gt;&lt;/script&gt;
   </diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -12,12 +12,17 @@ module Faye
     
     attr_reader :id   
     
-    def initialize(id)
+    def initialize(id, options = {})
       @id       = id
+      @options  = options
       @channels = Set.new
       @inbox    = Set.new
     end
     
+    def timeout
+      @options[:timeout] || TIMEOUT
+    end
+    
     def subscribe(channel)
       channel.add_observer(self) if @channels.add?(channel)
     end
@@ -70,7 +75,7 @@ module Faye
     
     def begin_connection_timeout!
       return unless @connected and @connection_timeout.nil?
-      @connection_timeout = add_timer(TIMEOUT) { flush! }
+      @connection_timeout = add_timer(timeout) { flush! }
     end
     
     def release_connection!</diff>
      <filename>lib/faye/connection.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ module Faye
       
       @endpoint = @options[:mount] || DEFAULT_ENDPOINT
       @script   = @endpoint + '.js'
-      @server   = Server.new
+      @server   = Server.new(@options)
     end
     
     def call(env)</diff>
      <filename>lib/faye/rack_adapter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 module Faye
   class Server
-    def initialize
+    def initialize(options = {})
+      @options  = options
       @channels = Channel::Tree.new
       @clients  = {}
       Thread.new { EventMachine.run } unless EventMachine.reactor_running?
@@ -215,7 +216,7 @@ module Faye
     
     def connection(id)
       return @clients[id] if @clients.has_key?(id)
-      client = Connection.new(id)
+      client = Connection.new(id, @options)
       client.add_observer(self)
       @clients[id] = client
     end</diff>
      <filename>lib/faye/server.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a453d80cc54d8b2f1fddd85492205ee3e7a09978</id>
    </parent>
  </parents>
  <author>
    <name>James Coglan</name>
    <email>jcoglan@googlemail.com</email>
  </author>
  <url>http://github.com/jcoglan/faye/commit/2a9d0077721b652b904198d2c834acb74950781d</url>
  <id>2a9d0077721b652b904198d2c834acb74950781d</id>
  <committed-date>2009-06-15T15:48:07-07:00</committed-date>
  <authored-date>2009-06-15T15:48:07-07:00</authored-date>
  <message>Allow the long-polling timeout to be set using an option on RackAdapter.</message>
  <tree>a0985d361753ad7ce32533a149b2ff62f7ce84e4</tree>
  <committer>
    <name>James Coglan</name>
    <email>jcoglan@googlemail.com</email>
  </committer>
</commit>
