From c5ed4f52235293b9b6bc26d435e5484e461cbb6d Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 26 Feb 2026 16:53:59 +0100 Subject: [PATCH] package/mosquitto: add option for websockets Mosquitto 2.1.x adds the possibility to use a builtin websocket implementation, as an alternative to using libwebsockets. When using libwebsockets as the implementation, only the broker supports websockets, and CLI tools do not; only when using the builtin one are websockets usable with CLI tools (and the broker, of course). Add a choice to select what type of websockets support to enable, if any. Since the builtin implementation is still new, we keep the libwebsockets one available. Since this inverts the dependency logic to libwebsockets, we can't provide a backward compatibility with existing (def)config files. Signed-off-by: Yann E. MORIN Cc: Peter Korsgaard Cc: Titouan Christophe Signed-off-by: Romain Naour --- package/mosquitto/Config.in | 25 ++++++++++++++++++++++++- package/mosquitto/mosquitto.mk | 4 +++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/package/mosquitto/Config.in b/package/mosquitto/Config.in index 754c07be78..789e30f97f 100644 --- a/package/mosquitto/Config.in +++ b/package/mosquitto/Config.in @@ -24,6 +24,30 @@ config BR2_PACKAGE_MOSQUITTO if BR2_PACKAGE_MOSQUITTO +choice + prompt "Websockets support" + help + Choose what websocket implementation to use. Note that + the mosquitto_{sub,pub,rr} clients (above) only support + websockets with the builtin implementation, while the + broker supports websockets with either libwebsockets + or the builtin implementation. + +config BR2_PACKAGE_MOSQUITTO_WS_NONE + bool "none" + +config BR2_PACKAGE_MOSQUITTO_WS_LIBWS + bool "with libwebsockets" + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_LIBWEBSOCKETS + select BR2_PACKAGE_LIBWEBSOCKETS_EXT_POLL + +config BR2_PACKAGE_MOSQUITTO_WS_BUILTIN + bool "with builtin implementation" + select BR2_PACKAGE_OPENSSL + +endchoice + config BR2_PACKAGE_MOSQUITTO_CLIENTS bool "install clients" default y # Backward compatibility @@ -52,7 +76,6 @@ config BR2_PACKAGE_MOSQUITTO_APPS config BR2_PACKAGE_MOSQUITTO_BROKER bool "install the mosquitto broker" default y - select BR2_PACKAGE_LIBWEBSOCKETS_EXT_POLL if BR2_PACKAGE_LIBWEBSOCKETS help Build and install the mosquitto broker onto target. diff --git a/package/mosquitto/mosquitto.mk b/package/mosquitto/mosquitto.mk index a1848f96b3..9b3bcc1cf5 100644 --- a/package/mosquitto/mosquitto.mk +++ b/package/mosquitto/mosquitto.mk @@ -41,9 +41,11 @@ MOSQUITTO_CONF_OPTS += \ -DWITH_TLS=ON \ -DWITH_TLS_PSK=ON -ifeq ($(BR2_PACKAGE_LIBWEBSOCKETS),y) +ifeq ($(BR2_PACKAGE_MOSQUITTO_WS_LIBWS),y) MOSQUITTO_DEPENDENCIES += libwebsockets MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=ON -DWITH_WEBSOCKETS_BUILTIN=OFF +else ifeq ($(BR2_PACKAGE_MOSQUITTO_WS_BUILTIN),y) +MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=ON -DWITH_WEBSOCKETS_BUILTIN=ON else MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=OFF -DWITH_WEBSOCKETS_BUILTIN=OFF endif