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

        if (event.type == 'participantStateChanged' &&
            event.state == 'disconnected' &&
            event.participant_type == 'WebUser')
          @state = stateEnum.KILLED

      setTimeout () =>
        @pollMessages()
      , 1000 if @state == stateEnum.STARTED || @state == stateEnum.START_PENDING

  sendMessage: (message) ->
    return unless message
    return @queueMessage(message) unless @state == stateEnum.STARTED

    $.post @endpoint, { event: { content: message } }, (data) =>
      @renderMessages data.events

  stateEnum = {
    INITIAL: 0
    START_PENDING: 1,
    ACTIVE: 2,
    TERMINATED: 3
  }

  constructor: ->
