Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;server
- (let [{:keys [ch-recv send-fn ajax-post-fn ajax-get-or-ws-handshake-fn
- connected-uids]} (sente/make-channel-socket! {})]
- (def ring-ajax-post ajax-post-fn)
- (def ring-ajax-get-or-ws-handshake ajax-get-or-ws-handshake-fn)
- (def ch-chsk ch-recv) ; ChannelSocket's receive channel
- (def chsk-send! send-fn) ; ChannelSocket's send API fn
- (def conn-uids connected-uids) ; Watchable, read-only atom
- )
- ;client
- (let [{:keys [chsk ch-recv send-fn state]}
- (sente/make-channel-socket! "/chsk" ; Note the same path as before
- {:type :auto ; e/o #{:auto :ajax :ws}
- })]
- (def chsk chsk)
- (def ch-chsk ch-recv) ; ChannelSocket's receive channel
- (def chsk-send! send-fn) ; ChannelSocket's send API fn
- (def chsk-state state) ; Watchable, read-only atom
- )
Advertisement
Add Comment
Please, Sign In to add comment