   tell:(options, callback) ->
     @handleRequest options.method, [options, callback]
 
+  send: (data) ->
+    try
+      if @readyState is READY
+        @ws.send JSON.stringify data
+        console.log "Sending", {data}
+      else
+        console.log "I'm still trying to reconnect, slow down..."
+    catch e
+      @disconnect()
+

      console.log "error: ", e, evt.data

  onError : (evt) -> console.log "#{@kiteName}: Error #{evt.data}"

  ready:(callback)->
    return KD.utils.defer callback  if @readyState

      remoteKite : @kiteName
      token      : KD.remote.getSessionToken()

    url = "http://localhost:4000/request" #kontrol addr

    # $.ajax was used here...
    xhr = new XMLHttpRequest
    xhr.open "POST", url, yes
    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
    xhr.send JSON.stringify requestData
    xhr.onload = =>
       if xhr.status is 200
         data = JSON.parse xhr.responseText
         @token = data[0].token
         @addr = data[0].addr
         @connectDirectly()

  disconnect:(reconnect=true)->
    @autoReconnect = !!reconnect  if reconnect?
    @ws.close()

  onOpen: ->
    console.log "connected"
    @clearBackoffTimeout()
    @readyState = READY
    @emit 'ready'
    @emit 'connected'

  onClose : (evt) ->
    console.log "#{@kiteName}: Disconnected"
    @readyState = CLOSED
    if @autoReconnect
      KD.utils.defer => @setBackoffTimeout @bound "connect"

  onMessage : (evt) ->
    try
