node.js - NodeJS + Express + Socket.IO + SSL -


so i'm trying use nodejs express + socket.io.

i've looked @ 5 other stack overflow questions, , looked on documentation point eyes feel they're going bleed!

i've got work following:

var fs           =  require('fs'),     privatekey   =  fs.readfilesync('/path/to/private.key').tostring(),     certificate  =  fs.readfilesync('/path/to/certificate.crt').tostring();  var options  = {                    key: privatekey,                    cert: certificate                };  var express  = require('express'),     app      = express(express.logger()),     https    = require('https'),     server   = https.createserver(options, app),     io       = require('socket.io').listen(server),     routes   = require('./routes');  app.configure(function() {     app.set('views', __dirname + '/views');     app.set('view engine', 'ejs');     app.use(express.bodyparser());     app.use(express.methodoverride());     app.use(app.router);     app.use(express.static(__dirname + '/public')); });   server.listen(5050, function() {     console.log("server a-hoy!"); });  app.get('/', routes.index);  io.sockets.on('connection', function (socket) {   socket.on('givemeresults', function (data) {     io.sockets.emit('results', { some: 'data' });   }); }); 

except fact when run this:

curl https://test.something.net:5050 

i following (not wanted) results

curl: (35) unknown ssl protocol error in connection test.something.net:5050  

the whole point of can use socket.io in background of our real webpage deliver information user.

it works when use normal http. certificates correct well.

can see possible reason failing?

i have had remove existing ssl certificate locations, , domain name, security reasons.

edit:

when running:

[root@example exampleapp]# node app.js    info  - socket.io started server a-hoy! 

honestly it's far easier have in front of node ssl (and faster - node's ssl support hasn't been optimized yet). use stud in front of haproxy in front of node, others use haproxy has ssl support.

stud easy setup, , has been rock solid us.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -