Using https with express memory

So, I am new to expression and io, but I had a server that works fine for webRTC, but now there is an outdated method in webRTC that only works on https, so I tried to create an https server, but it starts and then immediately coming out. I can’t understand what’s wrong, and I don’t have errors. I also use aws ec2 to start the express server. Maybe someone can determine where in my syntax / implementation I am wrong.

Note. I’ve been searching for the last half hour and can't figure it out

Here is the code:

var connect = require('connect'); var https = require('https'); var fs = require('fs'); var express = require('express.io'); var app = express(); //app.http().io(); var PORT = 443; var options = { key: fs.readFileSync('../server.key'), cert: fs.readFileSync('../server.crt') }; app.https(options).io(); //var app = https.createServer(options, app1); console.log('server started on port ' + PORT); app.use(express.static(__dirname + '/public')); app.get('/', function(req, res){ res.render('index.ejs'); }); app.listen(PORT); app.io.route('ready', function(req) { req.io.join(req.data.chat_room); req.io.join(req.data.signal_room); app.io.room(req.data).broadcast('announce', { message: 'New client in the ' + req.data + ' room.' }) }) 

Update

I invest in this reward because I want someone to provide me with a complete answer on setting up a server for production.

+7
javascript express
source share
1 answer

You need to add a rule for port 443 in the security group for your instance.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html can help.

+3
source

All Articles