                                     (succ (.getResponseJson xhr))
                                     (err xhr))))))))
 
-;; TODO this has to try more than once
-;; perhaps borrow exponential backoff from websocket?
-(defn http-connect [& [websocket-url']]
-  (js/setInterval
-   #(let [url (make-url websocket-url')]
-      (-> (http-get url)
-          (.then
+(defn http-connect [& [connect-url']]
+  (let [url (make-url connect-url')
+        surl (str url)
+        msg-fn (fn [msg]
+                 (try
+                   (glog/fine logger (pr-str msg))
+                   (message (assoc (js->clj msg :keywordize-keys true)
+                                   :http-url surl))
+                   (catch js/Error e
+                     (glog/error logger e))))]
+    (doto (.getQueryData url)
+      (.add "fwinit" "true"))
+    (.then (http-get url)
            (fn [msg]
-             (try
-               (glog/fine logger (pr-str msg))
-               (message (assoc (js->clj msg :keywordize-keys true)
-                               :http-url url))
-               (catch js/Error e
-                 (glog/error logger e)))))))
-   1000))
+             (msg-fn msg)
+             (js/setInterval
+              #(.then (http-get (make-url connect-url')) msg-fn)
+              1000)))))
 
 ))
 

         (fnil conj []) data))

(defn http-polling-connect [ring-request]
  (let [sess-id (-> ring-request :query-string parse-query-string :fwsid)]
    ;; new connection create the connection
    (if-not (get @*connections* sess-id)
      (let [conn (create-connection! ring-request
                                     {:type :http-polling
                                      :send-fn http-polling-send})]

                       c))
(defonce init-logger (do (.setCapturing log-console true) true))

;; dev
(.setLevel logger goog.debug.Logger.Level.FINE)

;; --------------------------------------------------------------
;; Bootstrap goog require reloading
;; --------------------------------------------------------------
