Socket.io + SSL cert problem
Hello I implemented this on my server.js: var express = require('express'), http = require('http'), https = require("https"), server = http.createServer(app), fs = require('fs');
var app = express();
//SSL Keys var privateKey = fs.readFileSync('sslcert/server.key'); var certificate = fs.readFileSync('sslcert/server.crt');
//Apply the SSL var credentials = {key: privateKey, cert: certificate}; var httpsServer = https.createServer(credentials, app);
//Start the connection //httpsServer.listen(8080, 'localhost'); httpsServer.listen(8080); console.log("Listening.....");
//Start Scoket.io var io = require("socket.io").listen(httpsServer, credentials);
When I visit my app I see:
ReferenceError: io is not defined var socket = io.connect('https://mydomain.com:8080');
Then, if I visit https://mydomain.com:8080/socket.io/socket.io.js I see NOT trusted connection and the tipical button to add an exception. My question is: is a problem with .key and .crt files? Is a problem of socket.io configuration?
Help please!!
Are you adding the socket.io client script in your page?
Yes I loading it via
You can better use nginx or haproxy to do the ssl part. Configure them as a load balancer on top of all your nodejs web stuff actually.
Do you still have the problem?
That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).