diff --git a/lib/service/index.js b/lib/service/index.js index 1778617..94259c1 100644 --- a/lib/service/index.js +++ b/lib/service/index.js @@ -164,7 +164,10 @@ Service.prototype.startWebServer = function(port, host) { self.announcement.webPort = address.port debug('[%s] web server started at %s:%s', self.name, address.address, address.port) - self.setHttpServer(server) + // Make sure listeners in `init()` could get this event. + process.nextTick(function() { + self.setHttpServer(server) + }) } }) }