WSS和HTTPS:连接建立错误:net :: ERR_CONNECTION_CLOSED

时间:2017-05-30 22:07:23

标签: node.js sockets

这是我从node.js服务器部分的摘录:

const WebSocketServer = require('ws').Server;
const wsPort = 3001;
const express = require('express');
const app = express();
const fs = require('fs');
var ssl = {
        key:  fs.readFileSync('/etc/letsencrypt/live/webtv.fr/privkey.pem'),
        cert: fs.readFileSync('/etc/letsencrypt/live/webtv.fr/cert.pem')
};
const https = require('https');
https.createServer(ssl, app).listen(8443);
const wsServer = new WebSocketServer({httpServer:https, port:wsPort});

const webPort = 3000;
app.use(express.static('public'));
const webServer = app.listen(webPort, function(){
});

当我转到https://webtv.fr:8443/

时,我继续在客户端收到该错误
  

与'wss://webtv.fr:3001 /'的WebSocket连接失败:错误输入   连接建立:net :: ERR_CONNECTION_CLOSED

0 个答案:

没有答案