* Parse the auth attribute and merge username and password in the options object. * * @param {Object} [opts] option object
(opts)
| 1095 | * @param {Object} [opts] option object |
| 1096 | */ |
| 1097 | function parseAuthOptions (opts) { |
| 1098 | var matches; |
| 1099 | if (opts.auth) { |
| 1100 | matches = opts.auth.match(/^(.+):(.+)$/); |
| 1101 | if (matches) { |
| 1102 | opts.username = matches[1]; |
| 1103 | opts.password = matches[2]; |
| 1104 | } else { |
| 1105 | opts.username = opts.auth; |
| 1106 | } |
| 1107 | } |
| 1108 | } |
| 1109 | |
| 1110 | /** |
| 1111 | * connect - connect to an MQTT broker. |