Self-signed certs with secure WebSockets in Node.js

First generate your self-signed certs:

Then create your httpsServer from an express app using node’s built-in https server:

Then setup your websocket server (ironically this will use the same port as the http server, I didn’t know this but I guess protocols can share ports? — this had me going for awhile).

Now browse to server and accept the self-signed cert in Chrome. Then websockets should now work isnide the browser.

Open a chrome devtools console and type:

Fibonacci generator using EcmaScript 6 (es6)

I took my first stab at the --harmony flag on node 11 to play with generators.

Thanks to this video:

Here’s a simple example of using an ES6 generator to generate the first 10 numbers in the Fibonnaci sequence: