I have done instructions from this page: https://medium.com/@invingagan/an-express-https-server-with-a-self-signed-certificate-and-socket-io-42d1f02d4d1a
That is, I created a self signed certificate:
openssl req -nodes -new -x509 -keyout server.key -out server.cert Then I use this server code:
var express = require('express'); var app = express(); var fs = require('fs'); app.use(express.static('public')); const server = require('https').createServer({ key: fs.readFileSync('server.key'), cert: fs.readFileSync('server.cert') }, app); var io = require('socket.io')(server); server.listen(1437, function () { console.log('https and websocket listening on *:1437'); }); However, when I try to connect using socket.io client, I got this error:
index.js:83 GET https://localhost:1437/socket.io/?framespersecond=15&audioBitrate=22050&EIO=3&transport=polling&t=NJLEHQL net::ERR_CERT_AUTHORITY_INVALID If I just copy and paste the URL in the browser URL field, I received the same error, so this is not a problem of socket.io client but the server miss to configure something.
I tried by creating a CA file and specify it in the call to createServer but it did not work either.
Any help?
Jaime
const ios = require(‘socket.io’)(secureServer);seems like you're missing this from the tutorial.