Is there any documentation or example on how to write a socket.io client that connects to a socket.io server securely (encrypted connection, not just plain-text token authentication)?
The following code shows how I create the server, I can test that the server is up using "curl --cacert ssl_cert.pem https://localhost":
// declarations
var fs = require('fs');
var io;
var app;
var httpsServ = require('https');
var host = "localhost";
var port = 443;
var processRequest = function (req, res) {
// empty method
}
// create httpsServ
app = httpsServ.createServer({
// server SSL key/cert files
key: fs.readFileSync("ssl_key.pem"),
cert: fs.readFileSync("ssl_cert.pem")
}, processRequest).listen(port);
// create io socket server
io = require('socket.io').listen(app, function () {
console.log("Server started and running " + host + ":" + port);
});
// implement request/response
io.sockets.on('connection', function (socket) {
socket.on("ClientRequest", function (data) {
// handle client request
});
});
// ...etc
Thank you in advance :)