some more doc comments and minor formatting

This commit is contained in:
Gered 2016-05-09 17:49:42 -04:00
parent 333e4873d5
commit 4fbf7b7c7d
2 changed files with 18 additions and 8 deletions

View file

@ -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)))

View file

@ -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!))