File tree 1 file changed +8
-7
lines changed
src/taoensso/sente/server_adapters
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 29
29
(ring-req->server-ch-resp [sch-adapter ring-req callbacks-map]
30
30
(let [{:keys [on-open on-close on-msg _on-error]} callbacks-map
31
31
ws? (websocket-req? ring-req)]
32
- (if ws?
33
- (d/chain (aleph/websocket-connection ring-req opts)
34
- (fn [s] ; sch
35
- (when on-msg (s/consume (fn [msg] (on-msg s ws? msg)) s))
36
- (when on-close (s/on-closed s (fn [] (on-close s ws? nil ))))
37
- (when on-open (do (on-open s ws?)))
38
- {:body s}))
32
+ (if-let [s (and ws? (try @(aleph/websocket-connection ring-req opts)
33
+ (catch Exception e nil )))]
34
+ (do
35
+ (when on-msg (s/consume (fn [msg] (on-msg s ws? msg)) s))
36
+ (when on-close (s/on-closed s (fn [] (on-close s ws? nil ))))
37
+ (when on-open (do (on-open s ws?)))
38
+ {:body s})
39
+
39
40
(let [s (s/stream )] ; sch
40
41
(when on-close (s/on-closed s (fn [] (on-close s ws? nil ))))
41
42
(when on-open (do (on-open s ws?)))
You can’t perform that action at this time.
0 commit comments