I'm trying to get a mosquitto broker to allow websockets on port 1884. For that I have edited the standard mosquitto.conf
as such:
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
listener 1883
allow_anonymous true
listener 1884
protocol websockets
allow_anonymous true
However that doesn't seem to work since when I start the broker, it says:
1652941249: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
1652941249: Using default config.
1652941249: Opening ipv4 listen socket on port 1883.
1652941249: Opening ipv6 listen socket on port 1883.
I've already tried adding a custom .conf file in the conf.d
file and have it included by the mosquitto.conf
but without success.
I have also noticed that whenever I try using the -c
-flag to specifiy which config to use, it seems to freeze before being able to start.
CodePudding user response:
First Using default config.
means that specific instance is not using the config file at all, it is using the build in defaults which as just to listen on port 1883.
Second, mosquitto doesn't have a default config file, you must always use the -c
option to pass the path to the config file you want to run.
Given the config file provided, it's probably not freezing, you have just told it to write the logs to a file so there will be NO output on the command line. You need to tail the /var/log/mosquitto/mosquitto.log
file to see the output (also there is a small bug in the logging code that means it only prints when the buffer has been filed so log entries may be delayed until enough has been written to the buffer).
And finally v1.4.x is VERY old, you should be running the v2.x version as it contains logs of bug/security fixes.