Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created October 13, 2011 18:59
Show Gist options
  • Save ppcano/1285161 to your computer and use it in GitHub Desktop.
Save ppcano/1285161 to your computer and use it in GitHub Desktop.
socket.io namespace error (Object #<SocketNamespace> has no method 'connect')
cio = require("socket.io-client")
io = require("socket.io")
var manager = io.listen( port );
manager.of('/chat').on('connection', function (socket) {
console.log('connecting socket on server');
});
var socket = cio.connect( 'http://localhost:'+port +'/chat' );
socket.on('connect', function() {
console.log('connected client ');
});
socket.connect( ); // this must be removed, it causes the error because it autoconnects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment