Socket.io Client Library Gives "welcome To Socket.io" Message
Solution 1:
This is caused by a commit made to the EventEmitter lib of nodejs in a recent change. I've opened an issue on socket.io.
https://github.com/LearnBoost/socket.io/issues/987
UPDATE
This issue has been fixed as of socket.io 0.9.12
Fix: https://github.com/LearnBoost/socket.io/blob/0.9.12/lib/manager.js#L116
Commit: https://github.com/LearnBoost/socket.io/commit/0d3313f536d0231932dd6617db449a071f5bc03a
Can not serve socket.io.js when listening on port. (node 0.9.1-pre, socket.io 0.9.9)
Due to a recent commit to node, you can no longer splice out event listeners. This causes socket.io to display the welcome message when trying to access the socket.io.js client file as the original event listener does not get removed.
Example breakage:
var socketIO = require('socket.io').listen(8000);
This breaks due to the way node 0.9.1-pre changed the way you can access listeners for the EventEmitter lib.
nodejs commit that breaks socket.io
Make EventEmitter.listeners(event) return a copy of the listeners array instead of the array itself.
EventEmitter.prototype.listeners = function(type) {
if (!isArray(this._events[type])) {
this._events[type] = [this._events[type]];
}
- returnthis._events[type];
+ returnthis._events[type].slice(0);
};
https://github.com/joyent/node/commit/20e12e4be37f394672c001fdb9b05c0275731901#L1R245
Relative socket.io code:
// reset listenersthis.oldListeners = server.listeners('request').splice(0);
https://github.com/LearnBoost/socket.io/blob/master/lib/manager.js#L115
Solution 2:
I ran into this problem a few days ago. Had to downgrade socket.io to v0.8.7 and it worked fine.
Post a Comment for "Socket.io Client Library Gives "welcome To Socket.io" Message"