devicescript icon indicating copy to clipboard operation
devicescript copied to clipboard

Simulator fails to connect with tls + user auth MQTT

Open pelikhan opened this issue 1 year ago • 0 comments

Create a private MQTT server on hivemq Pick a username/password Try to connect using mqtt library in simulator -> fail Try on esp32: success

import { connectMQTT } from "@devicescript/net"

const mqtt = await connectMQTT({
    host: "HIVEHQP.COM....",
    proto: "tls",
    port: 8883,
    username: "devicescript",
    password: "PASSWORD",
})
const payload = Buffer.from("hello")
await mqtt.subscribe("devs/tcp", async msg => {
    console.log(msg.content.toString("utf-8"))
})
await mqtt.publish("devs/tcp", payload)

pelikhan avatar Jun 30 '23 04:06 pelikhan