How to connect mqtt with Next.js properly? Receiving errors and the connection is unstable
I’m create a real-time web app with next.js 14, with App router.
I’m adding a MQTT connection, which is using Mosquito under the hood.
I’m using the mqtt.js library and connecting to the broker like this: