Forked from henryw-erudine/aleph-websocket-with-compojure
Created
January 7, 2015 17:42
-
-
Save ztellman/4ec27b21cc9bc9e88fec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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