         if cb
           cb false, true
 
-      'kite.consume': (opts, cb)->
+      'kite.consume': (opts, cb)=>
         @mergenData.lpop @getChannelNameForGenericName(), (err, val)=>
+          if not val
+            return
           console.log ">>>>>", err, val
           try
             val = JSON.parse val

      # @queueCommand "hello", ["world"], (ret)->
      #   console.log "queue command returned"

    subscribeCheck = setInterval ()=>
      if subscribeToChannelNames.length is 0
        clearTimeout subscribeCheck
        cb()
    , 10
    @connected = true

module.exports = class Kite extends EventEmitter
  {parse, stringify} = JSON

      checkrabbit = setInterval ()=>
        if rabbitReady
          clearInterval checkrabbit
          @db = @communicator.mergenData
          @emit 'kite-ready'
      , 10

