                     (assoc (apply hash-map config)
                       :peer_uri
                       url)))))
-
-(defn xhr-connection
-  "Returns a connection"
-  []
-  (goog.net.XhrIo.))

            v])
         (js->clj gxpc-config-fields))))

(defprotocol CrossPageChannel
  (register-service [this type fn] [this type fn encode-json?])

  (connect [this fn])

  (send-xpc [this type payload]))

(extend-type goog.net.xpc.CrossPageChannel

  CrossPageChannel
  (register-service [this type fn]
    (listen-parent this type fn false))
  (register-service [this type fn encode-json?]
    (.registerService parent (name type) fn encode-json?))

  (connect [this fn]
    (.connect this fn))

  (send-xpc [this type payload]
    (.send this (name type) payload)))

(defn cross-page-channel

          (js->clj goog.net.EventType)))))

(defprotocol IConnection
  (connect [this] [this opt1])
  (transmit
    [this opt]
    [this opt opt2]
    [this opt opt2 opt3]
    [this opt opt2 opt3 opt4]
    [this opt opt2 opt3 opt4 opt5])
  (close [this]))

(extend-type goog.net.XhrIo
