-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chris Granger <ibdknox@gmail.com>
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
(ns clj-socketio.examples.echo | ||
(:use clj-socketio.core)) | ||
|
||
(def server (create 8080)) | ||
(def clients (atom #{})) | ||
|
||
(on-connected (fn [client] | ||
(swap! clients conj client))) | ||
(on-connected server (fn [client] | ||
(swap! clients conj client))) | ||
|
||
(on-disconnect (fn [client] | ||
(swap! clients disj client))) | ||
(on-disconnect server (fn [client] | ||
(swap! clients disj client))) | ||
|
||
(on-message (fn [client msg] | ||
(println msg))) | ||
(on-message server (fn [client msg] | ||
(println msg))) | ||
|
||
(start server) |