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 <yann.morin@orange.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Titouan Christophe <titouan.christophe@mind.be>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
Yann E. MORIN
2026-02-26 16:53:59 +01:00
committed by Romain Naour
parent 53a885e48c
commit c5ed4f5223
2 changed files with 27 additions and 2 deletions

View File

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

View File

@@ -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