-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is port 9001 needed for Mosquitto? #67
Comments
I think its a good thing to remove it. since it's not needed for 99% of the usecases. I think you can make the pr. |
I think I will hold off until PR #69 has been applied. Just removing 9001 from the template probably wouldn't cause a conflict but I also intended to document the how-to of adding it back and that probably would create a conflict somewhere. Granted, I might be being a bit over-cautious in my estimation of what would and would not be likely to cause a conflict... |
I just merged #69, feel free! |
Following on from issue SensorsIot#67, this PR: 1. Removes the definition of port 9001 from the Mosquitto template; 2. Adds discussion to the Mosquitto documentation explaining how to support port 9001 *properly,* should the need arise.
you have to add a listener 9001 to mosquitto.conf for mosquitto to use it. This would allow web browsers to publish/subscibe to topics. |
Is port 9001 needed for Mosquitto?
Summary:
Chain of evidence
What eclipse-mosquitto image is on my RPi4?
What does Docker know about this image?
Observation: as far as
docker inspect
is concerned, only port 1883 is exposed.Assume IOTstack is not running.
What does
netstat
have to say about the baseline situation on the RPi4:Observation: no process is listening to either port 1883 or 9001.
Run-up mosquitto all by itself, explicitly specifying ports 1883 & 9001 (ie how docker-compose.yml does it at the moment):
What does
netstat
think outside the container?Observation: a process (Docker) is listening to ports 1883 & 9001.
What does
netstat
think inside the container?Observation: a process (mosquitto) is listening to port 1883 but nothing is listening to port 9001.
Any complaints in the log?
Observation: no complaints.
OK. Tear that down.
Now, repeat the test but this time without port 9001:
The
netstat
view from outside:Observation: no listener for port 9001 (as expected).
The
netstat
view from inside:Observation: no change – still only port 1883 (also as expected).
Any complaints in the log?
Observation: mosquitto is still happy.
OK. Tear that down.
Now for the acid test. Comment-out the line in
docker-compose.yml
:Bring up the stack:
Look at
netstat
both inside and outside:Observation: no sign of port 9001.
Anything in the log?
Observation: No complaints.
Conclusion: Port 9001 is not used and is probably not needed.
Googling
There are some references to port 9001:
fiware-tutorials
steves-internet-guide
A restricted Google search:
returns:
which suggests that, if there ever was a case for Mosquitto needing port 9001, it's disappeared into the bit-bucket of history.
Off-hand, I can't think of a use-case for Mosquitto to be involved in HTTP/Websocket comms. Can anyone else?
I do have a couple of use-cases for IoT devices communicating over HTTP but they do it with Node-Red, not Mosquitto:
Some brute force
Assuming there was a use-case for Mosquitto to chat over port 9001, it needs a bit more than just the port mapping in
docker-compose.yml
to get it going. In particular, these lines also need to be added tomosquitto.conf
:Both lines are needed - if you only add 9001 then 1883 stops working.
That definitely causes Mosquitto to listen on the port:
but it's an open question as to what you can actually do with it.....
Bottom line
My view is that port 9001 should be removed from the Mosquitto template, with the two-step how-to of enabling port 9001 put in the documentation for anyone who subsequently discovers a use-case.
If nobody objects to that plan, I'll prepare a pull request.
The text was updated successfully, but these errors were encountered: