heyujie
2021-05-24 4885600ecc369aa2e30a65de8dd7a410f13c34df
node_modules/mqtt/lib/connect/index.js
@@ -15,6 +15,9 @@
} else {
  protocols.wx = require('./wx')
  protocols.wxs = require('./wx')
  protocols.ali = require('./ali')
  protocols.alis = require('./ali')
}
protocols.ws = require('./ws')
@@ -76,7 +79,7 @@
  if (opts.cert && opts.key) {
    if (opts.protocol) {
      if (['mqtts', 'wss', 'wxs'].indexOf(opts.protocol) === -1) {
      if (['mqtts', 'wss', 'wxs', 'alis'].indexOf(opts.protocol) === -1) {
        switch (opts.protocol) {
          case 'mqtt':
            opts.protocol = 'mqtts'
@@ -86,6 +89,9 @@
            break
          case 'wx':
            opts.protocol = 'wxs'
            break
          case 'ali':
            opts.protocol = 'alis'
            break
          default:
            throw new Error('Unknown protocol for secure connection: "' + opts.protocol + '"!')
@@ -105,7 +111,9 @@
      'ws',
      'wss',
      'wx',
      'wxs'
      'wxs',
      'ali',
      'alis'
    ].filter(function (key, index) {
      if (isSecure && index % 2 === 0) {
        // Skip insecure protocols when requesting a secure one.