How to enable WSS(https) connection in Mosca (mqtt) broker in nodejs?

497 Views Asked by At

I have created mosca(js) server for mqtt broker in nodejs and enabled WebSocket connection using http option in mocha server .. but now problem is when I try to connect to broker from https(SSL secured) client the web browser does not allowing to connect over WS from https . so I have to create secured broker inorder to connect through WSS from client side.So there's option for secure in Mocha Option i.e : `

secure: {
    port: 1886,
    keyPath: "", //not sure what to put here 
    certPath: "", //not sure what to put here 
  }

my broker server is

var mqttServ = new mosca.Server({
  http: {
    port: 1885,
  },
  port: 1884,
  persistence: {
    factory: mosca.persistence.Mongo,
    url: config.mongo.uri,
  },
  secure: {
    port: 1886,
    keyPath: "", //path to ssl keypath i guess
    certPath: "", //path to ssl certpath i guess
  },
  bundle: true,
  static: "./",
  allowNonSecure: true,
});

anybody got any Idea ??

0

There are 0 best solutions below