 class @WebRTC
+  onConnected: ->
+  onHangedUp: ->
+  onReconnectingStarted: ->
+
   constructor: (userID, @localOutput, @remoteOutput) ->
     @_startOutput(@localOutput.tagName.toUpperCase() == 'VIDEO')
     @wsRails = new WebSocketRails(location.host + "/websocket?webrtc=true&user_identifier=" + userID)

        switch event['type']
          when 'call'
            @remoteUserID = event['remoteUserID']
          when 'offer'
            @_onOffer(event)
          when 'answer'

          candidate: event.candidate.candidate
        )

    peer.oniceconnectionstatechange = (event) =>
      switch peer.iceConnectionState
        when 'disconnected'
          @onReconnectingStarted()
        when 'connected', 'completed'
          if @_hangedUp
            @onConnected()
          @_hangedUp = false

    peer.addStream(@_localStream)
    peer.addEventListener('addstream', onRemoteStreamAdded, false)
    peer.addEventListener('removestream', onRemoteStreamRemoved, false)
