      [:button {:type "submit"} "Send"]]))
 
 (defn show-messages []
-  [:div#messages
-   (for [[[k v] index] (map vector (take-last 30 @messages) (range))]
-     ^{:key (str "message-" index)}
-     (let [{:keys [username message]} v]
-       [:div [:span.username username] ": " [:span.message message]]))])
+  (let [messages (subscribe [:chat-room-messages])]
+    [:div#messages
+     (for [[[k v] index] (map vector @messages (range))]
+       (let [{:keys [username message]} v]
+         ^{:key (str "message-" index)}
+         [:div [:span.username username] ": " [:span.message message]]))]))
 
 ;; -- Views -----------------
 

    (assoc db :username value)))

(register-handler
  :join-chat-room
  (fn [db [_ room-id]]
    (join-room room-id)
    (assoc db :chat-room room-id)))

(register-handler

   :messages []
   :username (str "Guest" (rand-int 100))})

;; -- Helpers ---------------

(defn- random-four-characters []
