'Mosquitto with MQTT.js Allowed Protocols

I have a mosquitto broker and I can connect to it using mqtt://, mqtts://, ws:// and wss:// protocols. Now is there a way to use ssl:// as protocol? I am using MQTT.js library.
I have seen two examples of this using Paho here and here



Solution 1:[1]

From the MQTT.js docs:

The URL can be on the following protocols: 'mqtt', 'mqtts', 'tcp', 'tls', 'ws', 'wss', 'wxs', 'alis'. The URL can also be an object as returned by URL.parse(), in that case the two objects are merged, i.e. you can pass a single object with both the URL and the connect options.

ssl:// is a legacy hold over from early IBM MQTT client libraries and probably should be deprecated in favour of mqtts:// they both mean the same thing, connect using Native MQTT over a TLS encrypted link.

If you want to support this URL style with a NodeJS client then I suggest you write a short bit of code to check if the input starts with ssl:// and replace it with mqtts://

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1