Skip to content

Instantly share code, notes, and snippets.

@zmaril
Created May 22, 2015 02:10
Show Gist options
  • Save zmaril/ce4cb4b17d62c33c1924 to your computer and use it in GitHub Desktop.
Save zmaril/ce4cb4b17d62c33c1924 to your computer and use it in GitHub Desktop.
(ns example.test
(:require [aleph.tcp :as tcp]
[manifold.stream :as stream]))
(defn handler [s info]
(println "START")
(println @(stream/take! s))
(println "STOP"))
(defn start-server
[port]
(tcp/start-server handler {:port port}))
(def server (start-server 5555))
(def c @(tcp/client {:port 5555 :host "localhost"}))
(stream/put! c "example")
;;Prints only the following
;;START
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment