diff --git a/lib/namespace.js b/lib/namespace.js index 8de303b620..db7db2cca2 100644 --- a/lib/namespace.js +++ b/lib/namespace.js @@ -1,4 +1,3 @@ - /** * Module dependencies. */ @@ -34,6 +33,14 @@ function SocketNamespace (mgr, name) { SocketNamespace.prototype.__proto__ = EventEmitter.prototype; +/** + * Copies emit since we override it + * + * @api private + */ + +SocketNamespace.prototype.$emit = EventEmitter.prototype.emit; + /** * Retrieves all clients as Socket instances as an array. * @@ -175,7 +182,7 @@ SocketNamespace.prototype.send = function (data) { SocketNamespace.prototype.emit = function (name) { if (name == 'connection' || name == 'newListener') { - return EventEmitter.prototype.emit.apply(this, arguments); + return this.$emit.apply(this, arguments); } return this.packet({