diff --git a/chat-demo/project.clj b/chat-demo/project.clj index 46586ed..d825af2 100644 --- a/chat-demo/project.clj +++ b/chat-demo/project.clj @@ -12,7 +12,7 @@ [prismatic/dommy "1.1.0"] [gered/clj-browserchannel "0.3"] [gered/clj-browserchannel-jetty-adapter "0.1.0"] - [gered/clj-browserchannel-immutant-adapter "0.0.1"] + [gered/clj-browserchannel-immutant-adapter "0.0.2"] [org.immutant/web "2.1.4"] [environ "1.0.3"]] diff --git a/chat-demo/src/chat_demo/server.clj b/chat-demo/src/chat_demo/server.clj index 8b76812..ebf7e04 100644 --- a/chat-demo/src/chat_demo/server.clj +++ b/chat-demo/src/chat_demo/server.clj @@ -58,7 +58,7 @@ (defn -main [& args] (if (env :dev) (pebble/set-options! :cache false)) - (run-jetty) - ;(run-immutant) + ;(run-jetty) + (run-immutant) ) diff --git a/clj-browserchannel-immutant-adapter/README.md b/clj-browserchannel-immutant-adapter/README.md index de3e909..7b0d062 100644 --- a/clj-browserchannel-immutant-adapter/README.md +++ b/clj-browserchannel-immutant-adapter/README.md @@ -1,10 +1,14 @@ # clj-browserchannel-immutant-adapter -Immutant async adapter for BrowserChannel +Immutant async adapter for BrowserChannel. See also: [clj-browserchannel][1] [1]:https://github.com/gered/clj-browserchannel +## Leiningen + + [gered/clj-browserchannel-immutant-adapter "0.0.1"] + ## About Written by: diff --git a/clj-browserchannel-immutant-adapter/project.clj b/clj-browserchannel-immutant-adapter/project.clj index ca9b515..d1a1c42 100644 --- a/clj-browserchannel-immutant-adapter/project.clj +++ b/clj-browserchannel-immutant-adapter/project.clj @@ -1,4 +1,4 @@ -(defproject gered/clj-browserchannel-immutant-adapter "0.0.1" +(defproject gered/clj-browserchannel-immutant-adapter "0.0.2" :description "Immutant async adapter for BrowserChannel" :dependencies [[gered/clj-browserchannel "0.3"]] :profiles {:provided diff --git a/clj-browserchannel-immutant-adapter/src/net/thegeez/browserchannel/immutant_async_adapter.clj b/clj-browserchannel-immutant-adapter/src/net/thegeez/browserchannel/immutant_async_adapter.clj index 46ab86e..a0bc8c8 100644 --- a/clj-browserchannel-immutant-adapter/src/net/thegeez/browserchannel/immutant_async_adapter.clj +++ b/clj-browserchannel-immutant-adapter/src/net/thegeez/browserchannel/immutant_async_adapter.clj @@ -22,14 +22,22 @@ (defn wrap-immutant-async-adapter "wraps the ring handler with an async adapter necessary for - browserchannel sessions." - [handler] + browserchannel sessions. + + options available: + + :response-timeout - Timeout after which the server will close the + connection. Specified in milliseconds, default + is 4 minutes which is the timeout period Google + uses." + [handler & [options]] (fn [request] (let [resp (handler request)] (if (= :http (:async resp)) (iasync/as-channel request - {:on-open + {:timeout (get options :response-timeout (* 4 60 1000)) + :on-open (fn [channel] (let [reactor (:reactor resp) emit (ImmutantResponse. channel)] @@ -44,8 +52,15 @@ use wrap-immutant-async-adapter instead and not use this function. options is passed directly to immutant. see immutant.web/run - for a description of the available options." + for a description of the available options. + + some additional options used by the async adapter are available: + + :response-timeout - Timeout after which the server will close the + connection. Specified in milliseconds, default + is 4 minutes which is the timeout period Google + uses." [handler options] (-> handler - (wrap-immutant-async-adapter) + (wrap-immutant-async-adapter options) (iweb/run options)))