0

我已经在nodejs中为mqtt代理创建了mosca(js)服务器,并使用mocha服务器中的http选项启用了WebSocket连接..但现在的问题是当我尝试从https(SSL安全)客户端连接到代理时,Web浏览器不允许通过 WS 从 https 连接。所以我必须创建安全代理才能从客户端通过 WSS 进行连接。所以 Mocha 选项中有安全选项,即:`

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

我的代理服务器是

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,
});

有人有任何想法吗?

4

0 回答 0