Skip to content

Commit 4495f59

Browse files
committed
Simplified remote events handling in Socket.
1 parent aad29d5 commit 4495f59

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

lib/socket.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ var parser = require('./parser')
1919

2020
exports = module.exports = Socket;
2121

22-
/**
23-
* Reserved event names.
24-
*/
25-
26-
var events = {
27-
message: 1
28-
, connect: 1
29-
, disconnect: 1
30-
, open: 1
31-
, close: 1
32-
, error: 1
33-
, retry: 1
34-
, reconnect: 1
35-
, newListener: 1
36-
};
37-
3822
/**
3923
* Socket constructor.
4024
*
@@ -149,7 +133,7 @@ Socket.prototype.setFlags = function () {
149133

150134
Socket.prototype.onDisconnect = function (reason) {
151135
if (!this.disconnected) {
152-
this.emit('disconnect', reason);
136+
this.$emit('disconnect', reason);
153137
this.disconnected = true;
154138
}
155139
};
@@ -342,7 +326,7 @@ Socket.prototype.$emit = EventEmitter.prototype.emit;
342326
*/
343327

344328
Socket.prototype.emit = function (ev) {
345-
if (events[ev]) {
329+
if (ev == 'newListener') {
346330
return this.$emit.apply(this, arguments);
347331
}
348332

0 commit comments

Comments
 (0)