这是我从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(){
});
时,我继续在客户端收到该错误
与'wss://webtv.fr:3001 /'的WebSocket连接失败:错误输入 连接建立:net :: ERR_CONNECTION_CLOSED