     return channel
 
   xhrHandshake: ->
+    console.log "bongo/xhrHandshake"
+    return @handshakeDone()
+
     @send 'xhrHandshake', (api) =>
       if @api
       then @handshakeDone()

  getInstanceMethods:-> ['changeLoggedInState','updateSessionToken']

  revive:(obj)->
    bongo = @
    hasEncoder = Encoder?.XSSEncode?
    new Traverse(obj).map (node)->

    xhr.send payload

  authenticateUser:->
    console.log "bongo/authenticateUser"

    clientId = @getSessionToken()
    @send 'authenticateUser', [clientId, @bound 'changeLoggedInState']

  handshakeDone:->
    console.log "bongo/handshakeDone"
    return  if @readyState is CONNECTED
    @readyState = CONNECTED
    console.log "bongo/handshakeDone/ready"
    @emit 'ready'
    @authenticateUser()

  defineApi:(api)->
    console.log "bongo/defineApi"

    if api?
      @api or= @createRemoteApiShims api
    @handshakeDone()

  changeLoggedInState:(state)->
    console.log "bongo/changeLoggedInState/state", state
    @emit 'loggedInStateChanged', state

  updateSessionToken:(token)->
    console.log "bongo/updateSessionToken/token", token
    @emit 'sessionTokenChanged', token

  fetchChannel:(channelName, callback)->
    console.log "bongo/fetchChannel/channelName", channelName
    return callback? new Error "not supported anymore"

    throw new Error "no broker client"  unless @mq?

    channel = @mq.subscribe channelName
