From 2f691a21113c8179c3dc6300f50aae728edaea0f Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Sun, 21 Sep 2014 18:59:25 +0700 Subject: [PATCH] Get started on #16 (client-side buffering) --- src/taoensso/sente.cljx | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/taoensso/sente.cljx b/src/taoensso/sente.cljx index c81d640..8c81d7d 100644 --- a/src/taoensso/sente.cljx +++ b/src/taoensso/sente.cljx @@ -367,9 +367,7 @@ newly-disconnected?)) send-fn ; server>user (by uid) push - (fn [user-id ev - ;; Extra arity currently undocumented: - & [{:as _opts :keys [flush-send-buffer?]}]] + (fn [user-id ev & [{:as opts :keys [flush?]}]] (let [uid user-id uid-name (str (or uid "nil")) _ (tracef "Chsk send: (->uid %s) %s" uid-name ev) @@ -413,7 +411,7 @@ (if (= ev [:chsk/close]) ; Currently undocumented (do (debugf "Chsk closing (client may reconnect): %s" uid-name) - (when flush-send-buffer? + (when flush? (doseq [type [:ws :ajax]] (flush-buffer! type))) @@ -438,9 +436,9 @@ ;; * We send to _all_ of a uid's connections. ;; * Broadcasting is possible but I'd suggest doing it rarely, and ;; only to users we know/expect are actually online. - (go (when-not flush-send-buffer? (