Next.js Discord

Discord Forum

MQTT Behaving Differently in Production Build

Answered
American Crocodile posted this in #help-forum
Open in Discord
American CrocodileOP
I am building an application to send and receive industrial data from a Programmable Logic Controller (PLC). In development mode, the application is working perfectly fine. When I build it, I can send data successfully, but I cannot receive data. I am using APP router. I have a route.js handling mqtt reception. I make API requests every 500ms to this route to get fresh data to the Client Side. How can I solve this problem
Answered by joulev
can you show the code?

also fyi you can connect to the mqtt broker directly from the frontend, using libraries like mqtt.js
View full answer

4 Replies

@joulev How do you host the app in production?
American CrocodileOP
For now I am using localhost..... ' npm run start'
@American Crocodile For now I am using localhost..... ' npm run start'
can you show the code?

also fyi you can connect to the mqtt broker directly from the frontend, using libraries like mqtt.js
Answer
@joulev can you show the code? also fyi you can connect to the mqtt broker directly from the frontend, using libraries like mqtt.js
American CrocodileOP
I connected to the broker from the front-end. It's working, thank you. Time to find a way to make that option more secure now.