-------- Faye HTTPS server -- index.js ------- const https = require('https'); const fs = require('fs'); function requestHandler(req, res){ console.log('request url = ', req.url); if(req.url == '/'){ res.end('Home Page - 201'); } else if(req.url == '/aaa'){ res.end('AAA'); } else if(req.url == '/bbb'){ res.end('BBB'); } else{ res.end('Cant fullfill this request'); } } serverOptions = { key : fs.readFileSync('./key.pem'), cert : fs.readFileSync('./cert.pem'), passphrase : '1234' } const httpsServer = https.createServer(serverOptions, requestHandler); httpsServer.listen(7000); -------- Faye HTTPS subscriber --- subscriber.js ------ faye = require('faye'); function msgReceived(msg){ console.log('Msg received'); console.log(msg.text); } function srvrNotRdy(){ console.log('===> Server is not ready'); } const recvClient = new faye.Client('https://localhost:7000'); recvClient.bind('transport:down', srvrNotRdy); recvClient.subscribe('/messages', msgReceived); console.log('--- subscription complete ---'); -------- Faye HTTPS publisher --- publisher.js ------ const faye = require('faye'); function srvrNotRdy(){ console.log('====> Server is not ready ...'); } const publisherClient = new faye.Client('https://localhost:7000'); publisherClient.bind('transport:down', srvrNotRdy); console.log('Going to publish message'); publisherClient.publish('/messages',{text : 'Test message - 7'}); console.log('Message published ...'); -------- Invocation results --------- Server runs fine: node index.js Running subscriber returns 'transport:down' error node subscriber.js --- subscription complete --- ===> Server is not ready Running publisher returns 'transport:down' error node publisher.js Going to publish message Message published ... ====> Server is not ready ... curl -k https://localhost:7000 Bad request