       @renderMessages data.events
 
   queueMessage: (message) ->
+    console.log "add " + message + " to " + @queuedMessages if @debug
     @queuedMessages.push(message)
 
   dismissWelcome: ->

    @queuedMessages = []
    @endpoint = '/interaction_web_tools/events'
    @chatUI = $('#chat-ui')

  open: =>
    @chatUI.toggleClass('active')


  dequeueMessages: ->
    $.each @queuedMessages, (i,message) =>
    console.log "dequeue messages " + @queuedMessages if @debug
      @sendMessage(message)
    @queuedMessages = []

  renderMessages: (messages) ->
    typing = $.grep messages, (el) -> el.type == 'typingIndicator' && el.content == true
    console.log "messages recieved for render", messages if @debug
    @displayIndicator("agent") if typing.length

    messages = $.grep messages, (el) -> el.type == 'text'
