     peer.oniceconnectionstatechange = (event) =>
       switch peer.iceConnectionState
         when 'disconnected'
-          @onReconnectingStarted()
           @_reconnectPeer()
+          @onWebRTCReconnectingStarted()
         when 'connected', 'completed'
           if @_hangedUp
-            @onConnected()
+            @onWebRTCConnected()
+          else
+            @onWebRTCReconnected()
           @_hangedUp = false
 
     peer.addStream(@_localStream)

            @_onCandidate(event)

  _addNetworkEventListener: ->
    window.addEventListener('offline', (event) =>
      @_webSocket.close()
    )

  _startHeartbeat: ->

class @WebRTC
  onWebSocketConnected: ->
  onWebSocketReconnectingStarted: ->
  onWebSocketReConnected: ->
  onWebRTCConnected: ->
  onWebRTCReconnectingStarted: ->
  onWebRTCReconnected: ->
  onWebRTCHangedUp: ->

  constructor: (userToken, @localOutput, @remoteOutput) ->
    @localOutput = @localOutput[0] || @localOutput
