Skip to content

Commit 2e5fb35

Browse files
embhornclaude
andcommitted
Add LWS_PROTOCOL_LIST_TERM compat for older libwebsockets
Ubuntu 22.04 ships libwebsockets < 4.1 which does not define LWS_PROTOCOL_LIST_TERM. Add a fallback define in both the broker and the websocket client so CI builds succeed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 30ebd0c commit 2e5fb35

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

examples/websocket/net_libwebsockets.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333

3434
#include <libwebsockets.h>
3535

36+
/* Compatibility for older libwebsockets versions (pre-4.1) */
37+
#ifndef LWS_PROTOCOL_LIST_TERM
38+
#define LWS_PROTOCOL_LIST_TERM { NULL, NULL, 0, 0, 0, NULL, 0 }
39+
#endif
40+
3641
/* Network context for libwebsockets */
3742
typedef struct _LibwebsockContext {
3843
struct lws_context *context;

src/mqtt_broker.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ static void BrokerTls_Free(MqttBroker* broker)
465465

466466
#include <libwebsockets.h>
467467

468+
/* Compatibility for older libwebsockets versions (pre-4.1) */
469+
#ifndef LWS_PROTOCOL_LIST_TERM
470+
#define LWS_PROTOCOL_LIST_TERM { NULL, NULL, 0, 0, 0, NULL, 0 }
471+
#endif
472+
468473
/* Forward declaration for the no-op connect callback (defined after WS section) */
469474
static int BrokerNetConnect(void* context, const char* host, word16 port,
470475
int timeout_ms);

0 commit comments

Comments
 (0)