📜  Socket.IO 无法通过 https 连接 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:06.542000             🧑  作者: Mango

代码示例1
var https = require('https'),     
    fs =    require('fs');        

var options = {
    key:    fs.readFileSync('ssl/server.key'),
    cert:   fs.readFileSync('ssl/server.crt'),
    ca:     fs.readFileSync('ssl/ca.crt')
};
var app = https.createServer(options);
io = require('socket.io').listen(app);     //socket.io server listens to https connections
app.listen(8895, "0.0.0.0");