The mqtt pub/sub worked well when tested on localhost, deployment on heroku was fine, but when I tried testing on Heroku it didn't work
I tried 2 commands to subscribe, both showed the same errors.
mosquitto_sub -p <port> -h <host> -t <topic>
Error: Connection refused Unable to connect (13).
mqtt_sub <port> <host> <topic>
node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: connect ECONNREFUSED at errnoException (net.js:670:11) at Object.afterConnect [as oncomplete] (net.js:661:19)
My main.js (server) code is similar to this one - https://gist.github.com/1826931. The error seems more like a node problem than a mqtt pub/sub problem, and I am new to node, so not quite sure how to debug it. I put in some console.log lines but as expected it didn't print since it's not connected. There is a dyno running
node main.js on Heroku fine.
Process State Command ------- ---------- ------------ web.1 up for 35m node main.js
Appreciate any advice on this issue.
Does Heroku support the opening of arbitrary ports on the the server?