This method will register a listener on the root endpoint ('/') for the event 'registerNewEndpointId'.
It allows processes to register new sub endpoints in the smart-router.
To do that, connect a socket.io client on the smart-router address and emit a 'registerNewEndpointId'
with the following JSON object: { name: 'endpointname', id: endpointid }.

Note that it is only possible to register new sub-endpoints for and existing endpoint,
not to create a new endpoint with its routes.
function () {
    var self = this;
    self.io.sockets.on('connection', function (socket) {
      socket.on('registerNewEndpointId', function(newEndpoint) {
        var endpointFound = false;
        logger.info(util.format('Request received to register new Endpoint: %s', JSON.stringify(newEndpoint)));
        self.config.endpoints.forEach(function (endpoint) {
          if (endpoint.name === newEndpoint.name) {
            endpointFound = true;
            if (endpoint.sub.indexOf(newEndpoint.id) < 0) {
              var socketendpoint = self.io.of('/' + newEndpoint.name + '/' + newEndpoint.id);
              logger.info(util.format('Endpoint registered on [/%s/%s]', newEndpoint.name, newEndpoint.id));
              self.registerRoutes(newEndpoint.name, newEndpoint.id, endpoint.queue, socketendpoint);

              endpoint.sub.push(newEndpoint.id); // Adding the new ID to the existing configuration.
              logger.info(util.format('Current config is now: %s', JSON.stringify(self.config)));
              socket.emit('endpointRegistered', {});
            }
            else {
              // Endpoint already exists
              var warnMsg = util.format('Endpoint [/%s/%s] already exists. Aborted.', newEndpoint.name, newEndpoint.id);
              logger.warn(warnMsg);
              self._storeNagiosEvent(new NagiosCheckResponse(NagiosCheckResponseCodes.WARNING, EVENTS_CONTROLLER_SUBSYSTEM, warnMsg));
              socket.emit('endpointRegistered', new Error(warnMsg));
            }
          }
        });
        if (!endpointFound) {
          var errMsg = util.format('[%s] is not a valid Endpoint.', newEndpoint.name);
          logger.error(errMsg);
          self._storeNagiosEvent(new NagiosCheckResponse(NagiosCheckResponseCodes.ERROR, EVENTS_CONTROLLER_SUBSYSTEM, errMsg));
          socket.emit('endpointRegistrationError', new Error(errMsg));
        }
      });
    });
  }