以下是代码:
var app = require('express.io')();
var fs = require('fs');
var io = require('socket.io');
var options = {
privateKey : fs.readFileSync(path1).toString(),
certificate : fs.readFileSync(path2).toString()
};
app.https(options).io();
//doesn't work anymore
app.post('/posts', function(req, res){ (...) }
//still works
app.listen(port, function())
//doens't work anymore
app.on('connection', function(socket){ (...) }
这是在我将socket.io从http移植到https(ssl)之后发生的。有人可以帮我解决这个问题吗?