Created
October 28, 2012 11:30
-
-
Save rodnaph/3968384 to your computer and use it in GitHub Desktop.
Simple Aleph websocket
This file contains 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
;; src/myapp/core.clj | |
(ns myapp.core | |
(:use lamina.core | |
aleph.http)) | |
(def ws-channel (channel)) | |
(defn app [ch _] | |
(receive ch | |
(fn [_] | |
(siphon ws-channel ch)))) | |
(defn send-message [msg] | |
(enqueue ws-channel msg)) | |
(start-http-server app {:port 1234 :websocket true}) | |
;; src/myapp/another.clj | |
; You can then send messages to connected peerrs | |
(send-message "foo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment