       (timbre/set-config! [:shared-appender-config :spit-filename] (:logfile @server-state))
       (run-server (site #'all-routes) {:port (:port @server-state) :join? false})))
 
+  (stop-server)
+
   )

  "Dispatch incoming websocket-requests"
  [{:keys [topic data] :as package}]
  (case topic
    :news-frequencies (assoc package :data (get-news-frequencies))
    :news-diffusion (assoc package :data (get-news-diffusion))
    :tweets-count (assoc package :data (curator/get-tweet-count))
    :init (assoc package :data
                 {:recent-articles (-> @server-state :app :recent-articles)

    (reset!
     state
     (-> path slurp read-string
         (assoc-in [:app :out-chans] [])
         (assoc-in [:app :recent-tweets] [])
         (assoc-in [:app :recent-articles] [])))
    (set-db (-> @state :app :db))))


(defn start-stream [state]
  (let [{:keys [follow track credentials]} (:app @state)
        [in out] (gezwitscher credentials)]
    (>!! in {:topic :start-stream :track track :follow follow})
    (let [output (<!! out)]
      (go-loop [status (<! (:status-ch output))]
        (when status
          (stream-handler state status)
          (recur (<! (:status-ch output))))))
    [in out]))


(defroutes all-routes
