Permalink
Browse files

Simplified remote events handling in Socket.

  • Loading branch information...
rauchg committed Jul 12, 2011
1 parent aad29d5 commit 4495f5987aa6136ea4c4a7afafd4e82ce457c29c
Showing with 2 additions and 18 deletions.
  1. +2 −18 lib/socket.js
View
@@ -19,22 +19,6 @@ var parser = require('./parser')
exports = module.exports = Socket;
/**
* Reserved event names.
*/
var events = {
message: 1
, connect: 1
, disconnect: 1
, open: 1
, close: 1
, error: 1
, retry: 1
, reconnect: 1
, newListener: 1
};
/**
* Socket constructor.
*
@@ -149,7 +133,7 @@ Socket.prototype.setFlags = function () {
Socket.prototype.onDisconnect = function (reason) {
if (!this.disconnected) {
this.emit('disconnect', reason);
this.$emit('disconnect', reason);
this.disconnected = true;
}
};
@@ -342,7 +326,7 @@ Socket.prototype.$emit = EventEmitter.prototype.emit;
*/
Socket.prototype.emit = function (ev) {
if (events[ev]) {
if (ev == 'newListener') {
return this.$emit.apply(this, arguments);
}

0 comments on commit 4495f59

Please sign in to comment.