lib/service-manager.js
function unregisterService (client, service, callback) {
  if (client.connected) {
    var request = new Request(DXL_SERVICE_UNREGISTER_REQUEST_TOPIC)
    request.payload = JSON.stringify({
      serviceGuid: service.info.serviceId})
    var unregisterCallback = null
    if (callback) {
      unregisterCallback = function (error) { callback(error) }
    }
    client.asyncRequest(request, unregisterCallback)
  }

  Object.keys(service.callbacksByTopic).forEach(function (topic) {
    service.callbacksByTopic[topic].forEach(function (callback) {
      client.removeRequestCallback(topic, callback)
    })
  })

  clearTtlTimeout(service)
}
function unregisterService (client, service, callback) {
  if (client.connected) {
    var request = new Request(DXL_SERVICE_UNREGISTER_REQUEST_TOPIC)
    request.payload = JSON.stringify({
      serviceGuid: service.info.serviceId})
    var unregisterCallback = null
    if (callback) {
      unregisterCallback = function (error) { callback(error) }
    }
    client.asyncRequest(request, unregisterCallback)
  }

  Object.keys(service.callbacksByTopic).forEach(function (topic) {
    service.callbacksByTopic[topic].forEach(function (callback) {
      client.removeRequestCallback(topic, callback)
    })
  })

  clearTtlTimeout(service)
}
function unregisterService ( client , service , callback ) { if ( client . connected ) { var request = new Request ( DXL_SERVICE_UNREGISTER_REQUEST_TOPIC ) request . payload = JSON . stringify ( { serviceGuid : service . info . serviceId } ) var unregisterCallback = null if ( callback ) { unregisterCallback = function ( error ) { callback ( error ) } } client . asyncRequest ( request , unregisterCallback ) } Object . keys ( service . callbacksByTopic ) . forEach ( function ( topic ) { service . callbacksByTopic [ topic ] . forEach ( function ( callback ) { client . removeRequestCallback ( topic , callback ) } ) } ) clearTtlTimeout ( service ) }
Unregisters the service from the DXL fabric.
@private
@param {Client} client - Client to be used for unregistering the service.
@param {Object} service - Metadata for the service.
@param {ServiceRegistrationInfo} service.info - Info supplied for the
service registration via a call to the
{@link ServiceManager#registerServiceAsync} function.
@param {Object} service.ttlTimeout - Id for the service's ttl callback.
@param {Function} [callback=null] - An optional callback that will be
invoked when the unregistration attempt is complete. If an error occurs
during the unregistration attempt, the first parameter supplied to the
callback contains an {@link Error} with failure details.
Unregisters the service from the DXL fabric .