websocket - How to create wss request on localhost on local machine -
we using 2 hpps servers, 1 using lampp, using nodejs. lampp https using 443 default port.
https://localhost:443/test/index.html
var websocketendpoint = 'wss://localhost:9000'; connection = new websocket(websocketendpoint); connection.onmessage = function (ping) { name = message.data; }
we have created seperate https server under /temp/ folder using nodejs below.
index.js
var https = require('https'); var fs = require('fs'); var express = require('express'); var expresswss = require('express-ws')(express()); var appws = expresswss.app; appws.use('/uploads',express.static('./uploads')); var options = { key: fs.readfilesync('fake-keys/key.pem'), cert: fs.readfilesync('fake-keys/crt.pem') }; var port = number(process.env.port || 9000); https.createserver(options, appws).listen(port, function () { console.log('listening on port:' + port); });
when making request via ws:// without https. working fine if making request via wss:// generating below error on locahost.
"firefox can't establish connection server @ wss://localhost:9000."
though, tried resolve issue directly hitting nodejs url via firefox browser , accepting ssl certificate(self signed) issue still appearing.
please suggest if there other way resolve error.
Comments
Post a Comment