mosquitto and websockets disconnect after initial packets

On trying to connect to a mosquitto broker running on FreeBSD, I see the connection established, the expected GET / HTTP/1.1 request followed by the expected HTTP/1.1 101 Switching Protocols response. However after that point, the connection gets shut down.

This is seen with configuration of the broker and client that was working in the past (I haven't looked at this page in detail in a few years). The broker responds properly to TCP connections. Using a Python client has the same problems with using websockets. A similarly configured broker under Debian with the same Paho JavaScript client runs without issue.

I'm running 12.4-RELEASE-p3 (amd64). I have tried both updating the packages, as well as rebuilding locally after finding https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262552 I'm aware of https://github.com/eclipse/mosquitto/issues/2755 which seems to have been filed by one of the people on the 262552 bug after the resolution of that bug back in February.

Code:
libwebsockets-4.3.2_1          C library for lightweight websocket clients and servers
mosquitto-2.0.15_1             Open source MQTT broker

Any additional suggestions?
 
diizzy Thanks but unfortunately, changing the configuration did not bring a positive effect.
Arduino connecting via MQTT works fine but after upgrade FreeBSD (and packages too) Websocket still reconnecting.

Bash:
1702809488: Sending CONNACK to mqttjs_14ace3fe (0, 0)
1702809489: Sending CONNACK to mqttjs_14ace3fe (0, 0)
1702809491: Sending CONNACK to mqttjs_14ace3fe (0, 0)

I've tried mosquitto and libwebsockets from ports and pkg.
Compiled on latest Mac OS X system and there is working fine - the same versions.
 
diizzy Ok, I just rebuild libwebsocket with options below:

Zrzut ekranu 2023-12-17 o 22.47.36.png


and next mosquitto from ports.
My config file:
Bash:
 /  bat /usr/local/etc/mosquitto/mosquitto.conf                                                                                                           Sun Dec 17 22:57:58 2023
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /usr/local/etc/mosquitto/mosquitto.conf
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ pid_file /var/run/mosquitto/mosquitto.pid
   2   │ user nobody
   3   │
   4   │ max_connections 52
   5   │ connection_messages true
   6   │ allow_anonymous true
   7   │
   8   │ listener 8083
   9   │ socket_domain ipv4
  10   │ protocol mqtt
  11   │
  12   │ log_dest file /var/log/mosquitto.log
  13   │ log_type error
  14   │ log_type warning
  15   │ log_type notice
  16   │ log_type information
  17   │ log_type debug
  18   │
  19   │ listener 9001
  20   │ socket_domain ipv4
  21   │ # listener 0 /var/run/mosquitto.sock
  22   │ protocol websockets
  23   │
  24   │ websockets_log_level 1
  25   │ websockets_headers_size 1024
  26   │
  27   │ certfile /usr/local/etc/letsencrypt/live/cert.pem
  28   │ cafile /usr/local/etc/letsencrypt/live/chain.pem
  29   │ keyfile /usr/local/etc/letsencrypt/live/privkey.pem
  30   │
  31   │ tls_version tlsv1
  32   │ # http_dir /usr/local/www/mosquitto

Still I can not connect via websocket by VueJS Plugin (working for 2 years) and desktop MQTTX client.
Bash:
  15   │ 1702850761: New client connected from 192.168.31.1:64709 as mqttjs_dfeabddf (p2, c1, k60).
  16   │ 1702850761: No will message specified.
  17   │ 1702850761: Sending CONNACK to mqttjs_dfeabddf (0, 0)
 
Found a solution.
I've cloned mosquitto GitHub repository and switch to branch develop.
There were necessary changes in variable typing, some small fixes and need to turn off tests.
After that everything working just fine!
 
Back
Top