问题
I have my code like below:
var gzippo = require('gzippo');
var app = require('express').createServer()
, io = require('socket.io').listen(app);
io.enable('browser client gzip');
io.set('transports', [
'websocket'
]);
app.use(gzippo.staticGzip(__dirname + '/'));
app.listen(8001);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/main2.html');
});
io.sockets.on('connection', function (socket) {...});
I use gzippo for gzip, express for http server, socket.io for websocket function.
The code beyond now work properly with requests from a ipv4 address.
So how to listen a request from my ipv6 address?
回答1:
It appears that socket.io fails to connect as it is unable to parse ipv6 url, cf https://github.com/LearnBoost/socket.io-client/issues/260
来源:https://stackoverflow.com/questions/8550656/node-jsexpresssocket-io-with-ipv6