mosquitto
mosquitto copied to clipboard
Websockets - bind address/host in listener doesn't work for websockets protocol
-
Tested on RaspberryPi, Mosquitto version 2.0.11
-
Application doesn't respect the bind address/host option for listener parameter when using websockets protocol. After changing protocol to MQTT everything works fine.
-
Tested configuration entry listener 9001 127.0.0.1 protocol websockets
-
netstat output masta@rpi-masta:/etc/mosquitto $ sudo netstat -tulnp | grep mosquitto tcp 0 0 127.0.0.1:1883 0.0.0.0:* LISTEN 3583/mosquitto
tcp6 0 0 :::9001 :::* LISTEN 3583/mosquitto
is that the whole configuration?
listener 9001 127.0.0.1
protocol websockets
running this tiny config in a container for 2.0.11 has the same issue. 2.0.12 does not. not sure if this is a libwebsockets or mosquitto issue, but you could try go up a few mosquitto versions too.
I'm facing a similar issue except that I am using 2.0.18.
config is: `allow_anonymous true listener 1883 protocol mqtt
listener 1884 protocol websockets`
netstat shows successful connections on 1883 but nothing even listening on 1884, even though the log during starting states
Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: mosquitto version 2.0.18 starting Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: Config loaded from /etc/mosquitto/mosquitto.conf. Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: Opening ipv4 listen socket on port 1883. Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: Opening ipv6 listen socket on port 1883. Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: Warning: Address family not supported by protocol Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: Opening websockets listen socket on port 1884. Jun 18 15:14:31 servername mosquitto[253693]: 1718723671: mosquitto version 2.0.18 running