Greetings!
I just noticed a problem in my code after upgrading to 0.8.0. Isolating the
bug got me to this minimal repro-case:
var LISTENPORT = 8081;
var connect = require('connect');
// this does not work:
/* var app = connect().use(connect.static('public-html'));
app.listen(LISTENPORT);
*/
// but this works (!)
var app = connect().use(connect.static('public-html')).listen(8081);
//
var io = require('socket.io').listen(app);
io.set('transports', ['websocket' // enable all supported transports
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling' ]);
io.sockets.on('connection', function(client) {
client.on('message', function(theMessage) {
console.log(theMessage);
});
});
The error I get when I have app.listen() on a separate line is this:
bt@ubuntu2:~/bb$ node test.js
info - socket.io started
/home/bt/bb/node_modules/connect/lib/proto.js:104
, fqdn = ~req.url.indexOf('://')
^
TypeError: Cannot read property 'url' of undefined
at Function.app.handle
(/home/bt/bb/node_modules/connect/lib/proto.js:104:18)
at Server.app (/home/bt/bb/node_modules/connect/lib/connect.js:66:31)
at Server.serverListening
(/home/bt/bb/node_modules/socket.io/node_modules/policyfile/lib/server.js:136:16)
at Server.g (events.js:185:14)
at Server.EventEmitter.emit (events.js:85:17)
at Server._listen2 (net.js:931:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I'm *really* interested in learning what causes this! Is there a
race-condition due to the fact that app.listen() is in a separate
statement? In essence, what is this bug and what can I do to not create it
in my own codebase?
(oh, and regarding versions: node:0.8.0, connect:2.3.4, and
socket.io:0.9.6, , installed on a fresh ubuntu 12.4 just a couple of hours
ago)
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en