diff --git a/index.js b/index.js index 390dc2f..35fed7c 100644 --- a/index.js +++ b/index.js @@ -519,10 +519,14 @@ function Server (opts) { } } -Server.prototype.listen = function (port) { +Server.prototype.listen = function (port, onlistening) { var self = this var tasks = [] + if (onlistening) { + self.once('listening', onlistening) + } + self._httpServer && tasks.push(function (cb) { self._httpServer.listen(port, cb) })