Mosquitto Websocket on Freebsd

I'm trying to run Mosquitto with WebSocket support on FreeBSD, but it's not working despite all efforts. Here's a summary of what I’ve done so far:

To run a WebSocket listener (port 9001) on Mosquitto so that clients (like MQTTX) can connect using the ws:// protocol.

I used mosquitto.config
Code:
listener 1883
protocol mqtt

listener 9001
protocol websockets

allow_anonymous true
And run this with command
$ mosquitto -c mosquitto.config -v



It gave a message like opening websockets listen socket on port 9001

But when connecting through mqttx response is like it get connect then closes its connection in same time and is working fine with mqtt 1883. Can anyone suggest what I am doing wrong here?
 

Attachments

  • post.PNG
    post.PNG
    323.6 KB · Views: 153
After googling a bit, it looks like you're trying to connect several times with the same client ID when it already had a connection with that ID.
 
its responding me with closed connection so tried to connect it again but same responce. i saw some posts they suggested me to use develop branch , there it will work but while cmake its giving me errors
 

Attachments

  • xx.PNG
    xx.PNG
    69.7 KB · Views: 133
I tried with 2.0.15 version as well but it's still responding same way.
while cmake i used this configs below.
Code:
cmake .. \
  -DWITH_WEBSOCKETS=ON \
  -DWITH_TLS=ON \
  -DWITH_CJSON=ON \
  -DBUILD_TESTING=OFF \
  -DCMAKE_C_FLAGS="-I/usr/local/include" \
  -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -lpthread" \
  -DLIBWEBSOCKETS_INCLUDE_DIR=/usr/local/include \
  -DLIBWEBSOCKETS_LIBRARIES=/usr/local/lib/libwebsockets.so
then ,
Code:
gmake clean
gmake -j$(sysctl -n hw.ncpu)
 

Attachments

  • zzzzz.PNG
    zzzzz.PNG
    53.7 KB · Views: 144
tried with this minimum config as well
cmake -DWITH_WEBSOCKETS=ON -DCMAKE_EXE_LINKER_FLAGS="-pthread" ..

but still output is while connecting to websocket is

New client connected from 192.168.1.58...
Sending CONNACK...
Client mqttx_fc7c4984 closed its connection.
 
Back
Top