 
 
 (defprotocol HydraServer
-  (hello    [this])
+  (hello    [this routing-id])
   (get-tags [this])
   (get-tag  [this tag])
   (get-post [this post-id])


(defn match-msg
  [server ^HydraMsg msg]
  (let [id (.id msg)]
    (println (= id HydraMsg/HELLO))
    (cond
     (= id HydraMsg/HELLO)    (hello    server)
     (= id HydraMsg/GET_TAGS) (get-tags server)
     (= id HydraMsg/GET_TAG)  (get-tag  server (.tag msg))



(defrecord Server [socket state]
  HydraServer
  (hello [this routing-id]
    ;; (next-state state :start :connected)
    (let [post-id (get-latest-post)]
      (msg/hello-ok socket routing-id post-id)))

  (get-tags [this]
    (ensure-state state :connected)
