eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Websockets - bind address/host in listener doesn't work for websockets protocol #3045

Open dchabrzyk opened 5 months ago

dchabrzyk commented 5 months ago
  1. Tested on RaspberryPi, Mosquitto version 2.0.11

  2. Application doesn't respect the bind address/host option for listener parameter when using websockets protocol. After changing protocol to MQTT everything works fine.

  3. Tested configuration entry listener 9001 127.0.0.1 protocol websockets

  4. 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

Daedaluz commented 5 months ago

is that the whole configuration?

listener 9001 127.0.0.1
protocol websockets
Daedaluz commented 5 months ago

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.

t-stamm commented 3 months ago

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