                         (fn [_] nil))]
               (if-not conn
                 ;; You didn't connect over ws://
-                invalid-websocket-response
+                invalid-response
 
-                (let [s (find-stream stream-id)]
-                  ;; Send existing nonsense
-                  (s/put! conn
-                          (str "insert:"
-                               (:text s)))
+                (d/let-flow [ready (s/take! conn)]
+                            (if (= ready "go")
+                              ;; First message must be "go"
+                              (let [s (find-stream stream-id)]
+                                ;; Send existing nonsense
+                                (s/put! conn
+                                        (str "insert:"
+                                             (:text s)))
 
-                  (s/put! conn
-                          (str "cursor:"
-                               (:pos s)))
+                                (s/put! conn
+                                        (str "cursor:"
+                                             (:pos s)))
 
-                  ;; Feed messages to clients
-                  (s/connect
-                   (bus/subscribe streamrooms stream-id)
-                   conn)))))
+                                ;; Feed messages to clients
+                                (s/connect
+                                 (bus/subscribe streamrooms stream-id)
+                                 conn))
+                              invalid-response)))))
 
 (defn new-stream-handler [request]
   (d/let-flow [conn (d/catch

                        (fn [_] nil))]
              (if-not conn
                ;; You didn't connect over ws://
                invalid-websocket-response

                ;; First message should be of the form "inited:<INITIAL TEXT>"
                (d/let-flow

                  (let [sid (Integer/parseInt stream-id)]
                    (if (find-stream sid)
                      (read-stream-handler sid request)
                      invalid-response))
                  (catch NumberFormatException _ invalid-response)))
           (GET "/new" req (new-stream-handler req)))
  (GET "/" [] "Home sweet home")
  (route/not-found "Not Found"))
