From 4fbf7b7c7d3629eae274e65fb32806f728b430ab Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 9 May 2016 17:49:42 -0400 Subject: [PATCH] some more doc comments and minor formatting --- .../browserchannel/immutant_async_adapter.clj | 12 +++++++++++- .../src/net/thegeez/browserchannel/client.cljs | 14 +++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) 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 3c98ac1..46ab86e 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 @@ -21,6 +21,8 @@ (iasync/close channel))) (defn wrap-immutant-async-adapter + "wraps the ring handler with an async adapter necessary for + browserchannel sessions." [handler] (fn [request] (let [resp (handler request)] @@ -35,7 +37,15 @@ resp)))) -(defn run-immutant [handler options] +(defn run-immutant + "convenience function for wrapping a ring handler with the necessary + immutant async adapter and also starting up an immutant server + at the same time. many applications may want to just directly + 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." + [handler options] (-> handler (wrap-immutant-async-adapter) (iweb/run options))) diff --git a/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs b/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs index b473b3a..05649e0 100644 --- a/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs +++ b/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs @@ -196,13 +196,13 @@ :on-sent (fn [delivered] ...) :on-error (fn [error-code] ...) - :on-open is called when a connection is (re-)established. - :on-close is called when a connection is closed. - :on-receive is called when data is received from the server. - :on-sent is called when data has been successfully sent to - the server ('delivered' is a list of what was sent). - :on-error is only invoked once just before the connection is - closed, and only if there was an error." + :on-open is called when a connection is (re-)established. + :on-close is called when a connection is closed. + :on-receive is called when data is received from the server. + :on-sent is called when data has been successfully sent to + the server ('delivered' is a list of what was sent). + :on-error is only invoked once just before the connection is + closed, and only if there was an error." [handler & [options]] (let [options (merge default-options options)] (events/listen js/window "unload" #(disconnect!))