-
-
Save bjering/fd1b5b2b1bbe08ff8c30 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
(ns chat.main | |
(:require | |
[chat.common] | |
[chat.channel] | |
[chat.server] | |
[chat.user] | |
)) | |
(defmethod print-method clojure.lang.IDeref [o w] (.write w (format "#<%s@%x>" (.getSimpleName (class o)) (System/identityHashCode o)))) | |
(def jonas (chat.user/create "Jonas")) | |
(def marcus (chat.user/create "Marcus")) | |
(def lobby (chat.channel/create "Lobby")) | |
(def channel-numbers (range 5000)) | |
(def user-numbers (range 10)) | |
(defn channel-name | |
[channel-number] | |
(str "channel_" (format "%05d" channel-number))) | |
(defn user-name | |
[channel-number user-number] | |
(str | |
"stressbot_" | |
(format "%05d" channel-number) | |
"_" | |
(format "%03d" user-number))) | |
(doseq | |
[channel-number channel-numbers] | |
(let | |
[channel (chat.channel/create (channel-name channel-number))] | |
(doseq [user-number user-numbers] | |
(let | |
[user (chat.user/create (user-name channel-number user-number))] | |
(chat.common/add-user-to-channel user channel))))) | |
(chat.common/add-user-to-channel jonas lobby) | |
(chat.common/add-user-to-channel marcus lobby) | |
(def channel-00000 (@chat.channel/channels "channel_00000")) | |
(chat.common/add-user-to-channel jonas channel-00000) | |
(chat.common/add-user-to-channel marcus channel-00000) | |
;(lobby :send :write ((jonas :state) :user-name) "Hej") | |
(def server (chat.server/create 4711)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment