       switch event['type']
         when 'myUserID'
           @_myUserID = event['myUserID']
-          console.log("userID: " + @_myUserID)
+          if @_webSocketConnected
+            @onWebSocketReConnected()
+          else
+            @onWebSocketConnected()
+            @_webSocketConnected = true
         when 'call'
           @_remoteUserID = event['remoteUserID']
         when 'hangUp'
-          @onHangedUp()
           @_hangedUp = true
           @_sendMessage(type: 'hangUpAnswer')
           @_stop()

        @_peerConnection.setLocalDescription(sessionDescription)
        @_sendSDP(sessionDescription)
      ->
        console.log 'Create Offer failed'
      @_mediaConstraints
    )


      track.enabled = enabled

  hangUp: ->
    @_sendMessage(type: 'hangUp')
    @_hangedUp = true

