         if (event.type == 'participantStateChanged' &&
             event.state == 'disconnected' &&
             event.participant_type == 'WebUser')
-          @started = false
+          @state = stateEnum.KILLED
 
       setTimeout () =>
         @pollMessages()
-      , 1000 if !@killed && @started
+      , 1000 if @state == stateEnum.STARTED || @state == stateEnum.START_PENDING
 
   sendMessage: (message) ->
     return unless message
-    return @queueMessage(message) unless @started
+    return @queueMessage(message) unless @state == stateEnum.STARTED
 
     $.post @endpoint, { event: { content: message } }, (data) =>
       @renderMessages data.events

    $.ajax
      url: @endpoint
      type: 'DELETE'

    @killed = true
    @started = false
    @startPending = false
    console.log "Chat Client Chat Terminated"


  send: (message) ->
    console.log "Chat Client wants to send message", message
    @startChat() unless @state == stateEnum.STARTED
    @sendMessage(message)

  startChat: ->
    return if @state == stateEnum.START_PENDING
    @state = stateEnum.START_PENDING
    @pollMessages()
    console.log "Chat Client Chat Start Peding"

  pollMessages: ->
    return if @state == stateEnum.KILLED
    console.log "Chat Client is polling for messages"
    $.get @endpoint, (data) =>
      @state = stateEnum.STARTED
      @dismissWelcome()
      @dequeueMessages()
      @renderMessages data.events
