 
   queue: (cmd, args, callback)->
     @communicator.queueCommand cmd, args, callback
+
 
   constructor:(@kiteName, @api, @publicKey)->
     if not @publicKey

            console.log "couldnt parse json"
            return
          console.log "!!!!!!!!!!!!! lpop lpop >>>>>>", val
          @receivedCommand val.from, null, val.cmd, val.args

  getChannelNameForKite:(genericName, uniqueName)->
    gn = genericName or @serviceGenericName

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

    startQueueChecker = ()=>
      setInterval ()=>
        @commands['kite.consume']()
      , 10

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


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