     @get('eventSource').close() if @get('eventSource')
 
   resetChannels: ->
+    @pause()
     @stop()
     params =
       url: '/event_stream'

        return if data.enabled == 'false'
        @set('eventSource', new EventSource(data.url))
        Ember.$(window).unload => @stop()
        data.eventNames.forEach (eventName) =>
          @addEventListener(eventName)
    Ember.$.ajax(params)

  msgResponse: (msg) ->
    esData = JSON.parse(msg.data)
    action = esData.action
    meta = esData.meta
    delete esData.meta

interval = 500
ETahi.EventStream = Em.Object.extend
  eventSource: null
  eventNames: null
  messageQueue: null
  wait: false
  init: ->
