lib/harmonyclient.js
function startActivity (activityId) {
  var timestamp = new Date().getTime()
  var body = 'activityId=' + activityId + ':timestamp=' + timestamp

  return this.request('startactivity', body, 'encoded', function (stanza) {
    // This canHandleStanzaFn waits for a stanza that confirms starting the activity.
    var event = stanza.getChild('event')
    var canHandleStanza = false

    if (event && event.attr('type') === 'connect.stateDigest?notify') {
      var digest = JSON.parse(event.getText())
      if (activityId === '-1' && digest.activityId === activityId && digest.activityStatus === 0) {
        canHandleStanza = true
      } else if (activityId !== '-1' && digest.activityId === activityId && digest.activityStatus === 2) {
        canHandleStanza = true
      }
    }
    return canHandleStanza
  })
}
function startActivity (activityId) {
  var timestamp = new Date().getTime()
  var body = 'activityId=' + activityId + ':timestamp=' + timestamp

  return this.request('startactivity', body, 'encoded', function (stanza) {
    // This canHandleStanzaFn waits for a stanza that confirms starting the activity.
    var event = stanza.getChild('event')
    var canHandleStanza = false

    if (event && event.attr('type') === 'connect.stateDigest?notify') {
      var digest = JSON.parse(event.getText())
      if (activityId === '-1' && digest.activityId === activityId && digest.activityStatus === 0) {
        canHandleStanza = true
      } else if (activityId !== '-1' && digest.activityId === activityId && digest.activityStatus === 2) {
        canHandleStanza = true
      }
    }
    return canHandleStanza
  })
}
function startActivity ( activityId ) { var timestamp = new Date ( ) . getTime ( ) var body = 'activityId=' + activityId + ':timestamp=' + timestamp return this . request ( 'startactivity' , body , 'encoded' , function ( stanza ) { // This canHandleStanzaFn waits for a stanza that confirms starting the activity. var event = stanza . getChild ( 'event' ) var canHandleStanza = false if ( event && event . attr ( 'type' ) === 'connect.stateDigest?notify' ) { var digest = JSON . parse ( event . getText ( ) ) if ( activityId === '-1' && digest . activityId === activityId && digest . activityStatus === 0 ) { canHandleStanza = true } else if ( activityId !== '-1' && digest . activityId === activityId && digest . activityStatus === 2 ) { canHandleStanza = true } } return canHandleStanza } ) }
Starts an activity with the given id.

@param activityId
@returns {Q.Promise}
Starts an activity with the given id .