-
-
Save schmee/7128ad47b35576187e86 to your computer and use it in GitHub Desktop.
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
(defn msg-loop [socket user running] | |
(when running | |
(println "running?" running) | |
(let [msg (read-line)] | |
(when (= msg "quit") | |
(println "disconnecting user" user) | |
(zend socket (str {:type :quit})) | |
(msg-loop socket user false)) | |
(zend socket (str {:type :msg :user user :msg msg})) | |
(recur socket user true)))) | |
(defn join [user] | |
(with-open [socket (Socket. "localhost" 8888)] | |
(register socket user) | |
(println "waiting for input") | |
(msg-loop socket user true))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment