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

      reviveSchemaRecursively this, schema

  createConstructor:(name, staticMethods, instanceMethods, attributes)->
    console.log "bongo/createConstructor"

    konstructor = Function('bongo', """
      return function #{name} () {

    @reconnectHelper()

    @channel.once 'broker.subscribed', =>
      trace "bongo/connectHelper/broker.subscribed/once"

      # apply the middleware
      @stack.forEach (fn)=> fn.call @

    @channel.on 'broker.subscribed', =>
      trace "bongo/connectHelper/broker.subscribed/on"
      @emit 'connected'

      if @disconnectedAt
        trace "bongo/connectHelper/@disconnectedAt"
        @emit 'reconnected', disconnectedFor: Date.now() - @disconnectedAt
        @disconnectedAt = null

      if @lastMessage
        trace "bongo/connectHelper/@lastMessage"
        @channel.publish @lastMessage
        @lastMessage = null


  connect:(callback)->
    trace "bongo/connect"
    @emit 'ready'
    @readyState = CONNECTED
    return callback? new Error "not supported anymore"
