Closed goldfire closed 11 years ago
In Express 3 'express' is a function not a server. So you have to pass it the server.
var server = http.createServer(app).listen(app.get('port'), function() {
console.log('Express server listening on port ' + app.get('port'));
}
var everyone = require('now').initialize(server);
excellent, thanks gscmedia, this fixed my problem too, also removed the notice I was getting "Socket.IO's listen()
method expects an http.Server
instance
as its first parameter. Are you migrating from Express 2.x to 3.x?
If so, check out the "Socket.IO compatibility" section at:
https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x"
For anyone in the future who runs across this thread, make sure you do the
var server = http.createServer(app);
before you do any of your app settings (e.g. app.use, app.set). It gave me serious trouble for hours.
When running Express 2.5.9 and below I can load the client script from /nowjs/now.js just fine, but when I switch to Express 3.0.0alpha2, I get: