From f1244005957865b9e8aada13a40df660aa0e3f30 Mon Sep 17 00:00:00 2001
From: Timotej S <6674623+underhood@users.noreply.github.com>
Date: Mon, 26 Jul 2021 17:55:08 +0200
Subject: [PATCH] Allows ACLK-NG to grow MQTT buffer (#11340)

* bumps mqtt_websockets to allow buffer growth on buffer full error
---
 aclk/aclk.c     | 8 +++++++-
 mqtt_websockets | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/aclk/aclk.c b/aclk/aclk.c
index 416f28e7ee..23d77291c4 100644
--- a/aclk/aclk.c
+++ b/aclk/aclk.c
@@ -562,7 +562,8 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
             .will_topic = "lwt",
             .will_msg   = NULL,
             .will_flags = MQTT_WSS_PUB_QOS2,
-            .keep_alive = 60
+            .keep_alive = 60,
+            .drop_on_publish_fail = 1
         };
 
 #ifndef ACLK_DISABLE_CHALLENGE
@@ -715,6 +716,11 @@ void *aclk_main(void *ptr)
         goto exit;
     }
 
+    // Enable MQTT buffer growth if necessary
+    // e.g. old cloud architecture clients with huge nodes
+    // that send JSON payloads of 10 MB as single messages
+    mqtt_wss_set_max_buf_size(mqttwss_client, 25*1024*1024);
+
     aclk_stats_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "statistics", CONFIG_BOOLEAN_YES);
     if (aclk_stats_enabled) {
         stats_thread = callocz(1, sizeof(struct aclk_stats_thread));
diff --git a/mqtt_websockets b/mqtt_websockets
index 6a64ebadf1..7849ed2a19 160000
--- a/mqtt_websockets
+++ b/mqtt_websockets
@@ -1 +1 @@
-Subproject commit 6a64ebadf19871acda156d0b5b4b0ee2e50153c5
+Subproject commit 7849ed2a1980d821cc708fc88fd2ca3d27149d23