Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)
NickName:Justin Elkow Ask DateTime:2014-03-29T09:08:20

Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)

I have an app with Node.js, Express.js, and Socket.io that runs fine using ANY port except 443. The server is meant to only operate over HTTPS port 443 and likewise, the websocket should be encrypted as well.

CODE THAT WORKS

var fs = require('fs');
var https = require('https');
var express = require('express');
var socket = require('socket.io');
var sslOptions = {
    key: fs.readFileSync(__dirname + '/../ssl/server.key,
    cert: fs.readFileSync(__dirname + '/../ssl/server.pem,
    ciphers: 'ECDHE-RSA-AES256-SHA:AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM',
    honorCipherOrder: true
};

var app = express();
var server = https.createServer(sslOptions, app);
var io = socket.listen(server, {
    "log level" : 3,
    "match origin protocol" : true,
    "transports" : ['websocket']
});
server.listen(8443);

When I change the port (last line) to 443, the Node server crashes right away with an error:

warn: error raised: Error: listen EADDRINUSE

Copyright Notice:Content Author:「Justin Elkow」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/22725717/node-js-express-js-socket-io-on-port-443-https-tls-ssl

Answers
ryankeener 2014-03-29T01:12:21

Apparently you've already got a server listening on that port on your machine. Is is possible that you started this server elsewhere and it's still running?",


More about “Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)” related questions

Node.js as gateway

I am thinking of using node.js as a gateway. I want to implement several frontends (browser, apps etc.) which get served by node.js with data over websockets. Node.js cannot fetch this data directl...

Show Detail

Why Node.js 8 is recommended instead of Node.js 10?

Why Node.js 8 is recommended for most users (on official site) instead of Node.js 10? Is it possible something working in Node.js 8 will not work in Node.js 10 (some npm packages for example)? In w...

Show Detail

wordpress and node.js

Is it possible to install wordpress and node.js server on same server maschine and use wordpress mysql database also from node.js? Also is it possible to have noSql also installed on thah server to...

Show Detail

Differences between Node.js Thread Pool and Clustering Node.js

Recently I've been researching about Node.js core architecture, but still I don't understand some concepts. So assume that I have 6 core CPU and it's an Intel CPU, so actually I have 12 logical

Show Detail

Node.js and HTML

I am new to node.js and I'm trying to run a script that uses Node.js' require() when a html button is clicked but it simply says "require" is not recognized (which makes sense). So how exactly ca...

Show Detail

Downside of node.js?

Disclaimer, my knowledge of node.js a few articles mostly summarized by this http://en.wikipedia.org/wiki/Node.js That said, so my understanding is that it's supposed to be very quick because it ...

Show Detail

Node.JS and Terminology

Excuse my ignorance, but I'm trying to wrap my head around the whole Node.js vs Backbone.js thing. I think I'm figuring it out, could somebody verify this or help adjust my understanding? Node.js ...

Show Detail

Node.js and PHP

I'm having a hard time figuring this out. I'm building a game and I want the game to be coded with Node.js (partly for learning and partly cause it seems right). But the game will also have a commu...

Show Detail

Embedding Node.js in Python

I am looking at the option of embedding node.js into python to add node.js functionality to my existing python code. I know that it can be done the other way around, as described in this post. Howe...

Show Detail

Appfog loadbalancing with node.js

Will Appfog load balancer forward multiple outstanding requests to the same node.js instance or does it allow only one outstanding request per instance? I couldn't find information on this on Appfog

Show Detail