Skip to content

Instantly share code, notes, and snippets.

@henryw-erudine
Created January 7, 2015 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save henryw-erudine/6b695872b8214ed798d3 to your computer and use it in GitHub Desktop.
Save henryw-erudine/6b695872b8214ed798d3 to your computer and use it in GitHub Desktop.
(ns com.x.aleph-test
(require [aleph.http :as http]
[manifold.deferred :as d]
[manifold.stream :as s]
[compojure.core :only [routes ANY GET PUT POST] :as compojure]
[compojure.handler :as handler]
[clj-http.client :as http-client]
))
(comment
(def compojure-ws-server
(http/start-server
(compojure/routes
(compojure/ANY "/yo" req
"yo-back!")
(compojure/ANY "/echo" req
(println "made it to here")
(let [s @(http/websocket-connection req)]
(s/connect s s))))
{:port 8080}))
(.close compojure-ws-server)
(-> (http-client/get "http://localhost:8080/yo")
:body)
(def client @(aleph.http/websocket-client "ws://localhost:8080/echo"))
(s/put! client "hello")
@(s/take! client)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment