change some default connection/timeout settings

This commit is contained in:
Gered 2014-12-27 17:41:28 -05:00
parent 143939af61
commit 17f15b797b
2 changed files with 20 additions and 13 deletions

View file

@ -78,22 +78,27 @@
You can specify the same set of options that You can specify the same set of options that
net.thegeez.browserchannel/wrap-browserchannel accepts, except for net.thegeez.browserchannel/wrap-browserchannel accepts, except for
:on-session (which will be overridden even if you do try to pass it). :on-session (which will be overridden even if you do try to pass it).
See net.thegeez.browserchannel/default-options for more info.
Note that if :base is not specified, the default is '/browserchannel' See net.thegeez.browserchannel/default-options for more info on available
(this differs from net.thegeez.browserchannel/wrap-browserchannel). options and what the defaults are. Some defaults are different when
using this middleware:
In addition, you can pass event handler functions. Note that the return :base \"/browserchannel\"
value for all of these handlers is not used." :keep-alive-interval 20
:session-timeout-interval 30"
[handler & [opts]] [handler & [opts]]
(-> handler (let [opts (merge
(browserchannel/wrap-browserchannel {:base "/browserchannel"
(assoc :keep-alive-interval 20
opts :session-timeout-interval 30}
:base (or (:base opts) "/browserchannel") opts)]
:on-session (-> handler
(fn [browserchannel-session-id request] (browserchannel/wrap-browserchannel
(handle-session browserchannel-session-id request)))))) (assoc
opts
:on-session
(fn [browserchannel-session-id request]
(handle-session browserchannel-session-id request)))))))
(defn init! (defn init!
"Sets up browserchannel for server-side use. This function should be called "Sets up browserchannel for server-side use. This function should be called

View file

@ -176,6 +176,8 @@
(.disconnect browser-channel) (.disconnect browser-channel)
(events/removeAll))) (events/removeAll)))
(set-debug-logger! goog.debug.Logger.Level.OFF) (set-debug-logger! goog.debug.Logger.Level.OFF)
; this seems to help prevent premature session timeouts from occuring (vs the default of 3)
(set! goog.net.BrowserChannel/BACK_CHANNEL_MAX_RETRIES 20)
(.setHandler browser-channel (->handler)) (.setHandler browser-channel (->handler))
(.connect browser-channel (.connect browser-channel
(str base "/test") (str base "/test")