Added TLS (https/wws) support, including autogeneration of self-certified cert.pem and key.pem files if missing.