Https服务器用socket和express

时间:2018-03-21 09:08:30

标签: node.js sockets

我正在使用SSL来加密我的后端,但是我当前的解决方案打开了两个端口,一个用于套接字,另一个用于快速,任何方法都可以在同一个端口上启动,如HTTP?

        layerAnimation = CABasicAnimation(keyPath: "path")
        layerAnimation.fromValue = shapeLayer.path
        layerAnimation.toValue = newBezierPath
        shapeLayer.path = newBezierPath

在ssl部分也运行const port=4000; if(process.env.ENABLE_SSL=='true') { ////two ports are open 8989,4000 server = https.createServer({ key: fs.readFileSync("sslLocation/ssl.key"), cert: fs.readFileSync("sslLocation/ssl.cert") },app).listen("8989", '0.0.0.0',function(){ console.log('Express server listening to port 8989'); }); global.io = require('socket.io').listen(server); app.listen(port); } else { ////one port only // start the server server = app.listen(port, function () { console.log(`App is running at: localhost:${server.address().port}`); }); global.io = require('socket.io').listen(server); } ,我无法访问apis

0 个答案:

没有答案