File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 6
6
. # *
7
7
.DS_Store
8
8
.lein-repl-history
9
- .nrepl-port
9
+ .nrepl-port
10
+ node_modules /
Original file line number Diff line number Diff line change 49
49
50
50
; ; Sente does not support CLJ as a client yet
51
51
#?(:cljs
52
- (defrecord ChannelSocketClient [chsk ch-chsk chsk-send! chsk-state router path handler options]
52
+ (defrecord ChannelSocketClient [chsk ch-chsk chsk-send! chsk-state path router handler options]
53
53
component /Lifecycle
54
54
(start [component]
55
- (let [handler (or handler (get-in component [:sente-handler :handler ]))
56
- {:keys [chsk ch-recv send-fn state]}
57
- (sente/make-channel-socket-client! path options)]
58
- (assoc component
59
- :chsk chsk
60
- :ch-chsk ch-recv
61
- :chsk-send! send-fn
62
- :chsk-state state
63
- :router (atom (sente/start-chsk-router! ch-recv (if (:wrap-component? options)
64
- (handler component)
65
- handler))))))
55
+ (let [{:keys [chsk ch-recv send-fn state]} (sente/make-channel-socket-client! path options)
56
+ component (assoc component
57
+ :chsk chsk
58
+ :ch-chsk ch-recv ; ChannelSocket's receive channel
59
+ :chsk-send! send-fn ; ChannelSocket's send API fn
60
+ :chsk-state state)]
61
+ (if handler
62
+ (assoc component :router (atom (sente/start-chsk-router! ch-recv handler)))
63
+ component)))
66
64
(stop [component]
67
65
(if-let [stop-f (and router @router)]
68
66
(assoc component :router (stop-f ))
69
67
component))))
70
68
71
69
#?(:cljs
72
70
(defn new-channel-socket-client
71
+ ([]
72
+ (new-channel-socket-client nil " /chsk" {}))
73
73
([path]
74
74
(new-channel-socket-client nil path {}))
75
75
([event-msg-handler path]
You can’t perform that action at this time.
0 commit comments