Guest User

Untitled

a guest
Jul 3rd, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;server
  2. (let [{:keys [ch-recv send-fn ajax-post-fn ajax-get-or-ws-handshake-fn
  3.               connected-uids]} (sente/make-channel-socket! {})]
  4.   (def ring-ajax-post ajax-post-fn)
  5.   (def ring-ajax-get-or-ws-handshake ajax-get-or-ws-handshake-fn)
  6.   (def ch-chsk ch-recv)                                     ; ChannelSocket's receive channel
  7.   (def chsk-send! send-fn)                                  ; ChannelSocket's send API fn
  8.   (def conn-uids connected-uids)                       ; Watchable, read-only atom
  9.   )
  10.  
  11.  
  12. ;client
  13.  
  14.   (let [{:keys [chsk ch-recv send-fn state]}
  15.         (sente/make-channel-socket! "/chsk" ; Note the same path as before
  16.                                     {:type :auto ; e/o #{:auto :ajax :ws}
  17.                                      })]
  18.     (def chsk       chsk)
  19.     (def ch-chsk    ch-recv) ; ChannelSocket's receive channel
  20.     (def chsk-send! send-fn) ; ChannelSocket's send API fn
  21.     (def chsk-state state)   ; Watchable, read-only atom
  22.     )
Advertisement
Add Comment
Please, Sign In to add comment