Skip to content

Commit 7cca8fc

Browse files
committed
Initial commit
0 parents  commit 7cca8fc

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ClojureTO Workshop Chat Server
2+
3+
This is a skeleton project for a chat server we'll use to build a chat client and server. Hopefully, we'll work together to build a full featured chat web app. Then we can finally have a backchannel to chat about the ClojureTO Workshop while we learn clojure!
4+
5+
## Week 1
6+
(Which is week 3 of the workshop if you're paying attention)
7+
8+
To start we'll work in groups on implementing a very basic server that listens on a socket and routes messages, and a client that can talk to it.
9+
10+
Start by implementing the protocol below. Don't worry about concurrency yet! The library included in this skeleton project `clj-sockets` is synchronous, so no need to read up on Clojure concurrency primitives or core.async channels. Start with a synchronous server, and we'll make it async next week.
11+
12+
### The Protocol
13+
- It's a line based protocol. Newline signifies end of message
14+
- channel and nicknames can contain only `[a-z|A-Z|0-9|-+]`,
15+
- channel names must begin with #,
16+
- usernames can begin with any character other then #
17+
- After connecting, each user sends `USER nickname` as their first command
18+
- At first there's only one channel, `#general`, we'll add more later!
19+
- Messaging a user is done with `MSG nickanme message`
20+
- Messaging a channel is done with `MSG #channel message`
21+
22+
### Goals for Week 1
23+
- Get a feel for working with a project larger then one function
24+
- Write a couple of tests (either with [clojure.test](https://clojure.github.io/clojure/clojure.test-api.html) or [midje](https://github.com/marick/Midje)).
25+
- Try to practice REPL-driven development
26+
- Think about how to organize code into namespaces
27+
- Have fun!!!

project.clj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(defproject chat-server "0.1.0-SNAPSHOT"
2+
:description "FIXME: write description"
3+
:url "http://example.com/FIXME"
4+
:license {:name "Eclipse Public License"
5+
:url "http://www.eclipse.org/legal/epl-v10.html"}
6+
:dependencies [[org.clojure/clojure "1.6.0"]
7+
[clj-sockets "0.1.0"]]
8+
:main ^:skip-aot chat-server.core
9+
:target-path "target/%s"
10+
:profiles {:uberjar {:aot :all}})

src/chat_server/.#.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
maxim@nabokov.local.268

src/chat_server/core.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(ns chat-server.core
2+
(:require [clj-sockets.core :as socket :refer []])
3+
(:gen-class))
4+
5+
(defn -main
6+
"I don't do a whole lot ... yet."
7+
[& args]
8+
(println "Hello, World!"))

test/chat_server/core_test.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ns chat-server.core-test
2+
(:require [clojure.test :refer :all]
3+
[chat-server.core :refer :all]))
4+
5+
(deftest a-test
6+
(testing "FIXME, I fail."
7+
(is (= 0 1))))

0 commit comments

Comments
 (0)