Skip to content

Instantly share code, notes, and snippets.

@ztellman
Created December 31, 2013 07:12
Show Gist options
  • Select an option

  • Save ztellman/8193598 to your computer and use it in GitHub Desktop.

Select an option

Save ztellman/8193598 to your computer and use it in GitHub Desktop.
(defn persistent-socket
"Returns a channel, and a callback to be passed into a persistent-connection function"
(let [in (channel)
out (channel)
socket (splice out in)]
[socket
(fn [connection]
(connect out socket false true)
(connect socket in true false))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment