Closed wiebeytec closed 3 days ago
@wiebeytec We are already generating a (kind of) random identifier to identify VRM token on each login, so I will invent something that will be visible on the VRM token management page and will be used as well when connecting to MQTT. That should make pairing things together easy.
I do not see a problem using Math.random
in our situation, probability of collision when connecting from multiple loaders to the same VenusOS on LAN seems rather low, and in case of VRM I added the VRM token ID to identify client, as token IDs shall be unique for each loader instance.
For debugging, it's always convenient to have recognizable client IDs. The default is
'mqttjs_' + Math.random().toString(16).substr(2, 8)
. This is generic, and the randomness is bad. If 'random()` is 0, the string is empty.Unfortunately the MQTT protocol puts the burdon of good random uniqueness on the client. Do you have
crypto
available in all run-time environments? If so, we can do: