Tuesday 30 May 2017

WSS and HTTPS: Error in connection establishment: net::ERR_CONNECTION_CLOSED

Here is my extract from node.js server part:

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(){
});

I keep on receiving that error on client side when I go to https://webtv.fr:8443/

WebSocket connection to 'wss://webtv.fr:3001/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED



via yarek

No comments:

Post a Comment