diff --git a/src/taoensso/sente/server_adapters/undertow.clj b/src/taoensso/sente/server_adapters/undertow.clj index 8ca7703..81ea377 100644 --- a/src/taoensso/sente/server_adapters/undertow.clj +++ b/src/taoensso/sente/server_adapters/undertow.clj @@ -2,7 +2,6 @@ "Sente server adapter for ring-undertow-adapter." {:author "Nik Peric"} (:require - [clojure.core.async :as async] [ring.adapter.undertow.websocket :as websocket] [ring.adapter.undertow.response :as response] [taoensso.sente.interfaces :as i]) @@ -40,24 +39,30 @@ (defprotocol ISenteUndertowAjaxChannel (ajax-read! [sch])) -(deftype SenteUndertowAjaxChannel [resp-ch open?_ on-close _adapter-opts] +(deftype SenteUndertowAjaxChannel [resp-promise_ open?_ on-close adapter-opts] i/IServerChan - (sch-send! [sch websocket? msg] (async/put! resp-ch msg (fn [_] (i/sch-close! sch)))) + (sch-send! [sch websocket? msg] (deliver resp-promise_ msg) (i/sch-close! sch)) (sch-open? [sch] @open?_) (sch-close! [sch] (when (compare-and-set! open?_ true false) + (deliver resp-promise_ nil) (when on-close (on-close sch false nil)) - (async/close! resp-ch) true)) ISenteUndertowAjaxChannel - (ajax-read! [sch] (async/