From cb0ca6d6dd607353ec214b0b6523b21ee0cecafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=88=90=E9=94=B4?= Date: Sun, 4 Dec 2022 22:43:30 +0800 Subject: [PATCH] Allow user customization WS_MAX_QUEUED_MESSAGES --- src/AsyncWebSocket.cpp | 2 +- src/AsyncWebSocket.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp index ad197ebc7..3047402d7 100644 --- a/src/AsyncWebSocket.cpp +++ b/src/AsyncWebSocket.cpp @@ -102,7 +102,7 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool return 0; } } - client->send(); + if (!client->send();) return 0; return len; } diff --git a/src/AsyncWebSocket.h b/src/AsyncWebSocket.h index fd9eeed96..9d137288a 100644 --- a/src/AsyncWebSocket.h +++ b/src/AsyncWebSocket.h @@ -24,11 +24,15 @@ #include #if defined(ESP32) || defined(LIBRETUYA) #include +#ifndef WS_MAX_QUEUED_MESSAGES #define WS_MAX_QUEUED_MESSAGES 32 +#endif #else #include +#ifndef WS_MAX_QUEUED_MESSAGES #define WS_MAX_QUEUED_MESSAGES 8 #endif +#endif #include #include "AsyncWebSynchronization.h"