Skip to content

Commit

Permalink
Allow user customization WS_MAX_QUEUED_MESSAGES (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
asjdf authored Feb 16, 2023
1 parent 4fd0a1f commit c4ced25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AsyncWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool
return 0;
}
}
client->send();
if (!client->send();) return 0;

This comment has been minimized.

Copy link
@rob040

rob040 Aug 15, 2023

@asjdf: This change causes compilation error in platformIO esp32:

Compiling .pio\build\esp32dev_dbg\liba26\ESPAsyncWebServer-esphome\AsyncWebSocket.cpp.o
.pio/libdeps/esp32dev_dbg/ESPAsyncWebServer-esphome/src/AsyncWebSocket.cpp: In function 'size_t webSocketSendFrame(AsyncClient*, bool, uint8_t, bool, uint8_t*, size_t)':
.pio/libdeps/esp32dev_dbg/ESPAsyncWebServer-esphome/src/AsyncWebSocket.cpp:105:7: warning: init-statement in selection statements only available with -std=c++17 or -std=gnu++17
   if (!client->send();) return 0;
       ^
.pio/libdeps/esp32dev_dbg/ESPAsyncWebServer-esphome/src/AsyncWebSocket.cpp:105:23: error: expected primary-expression before ')' token
   if (!client->send();) return 0;
                       ^
*** [.pio\build\esp32dev_dbg\liba26\ESPAsyncWebServer-esphome\AsyncWebSocket.cpp.o] Error 1

Removing the ';' solves the error.

This comment has been minimized.

Copy link
@asjdf

asjdf Aug 15, 2023

Author

oh! I am sorry that I made this mistake. Thanks for your suggestion.

This comment has been minimized.

Copy link
@rob040

rob040 Aug 15, 2023

There is already a pullrequest #11 for this, I just saw.

This comment has been minimized.

Copy link
@rob040

rob040 Aug 15, 2023

And pullrequest #17 about the same

This comment has been minimized.

Copy link
@rob040

rob040 Aug 15, 2023

Annd pullrequest #21 about the same

return len;
}

Expand Down
4 changes: 4 additions & 0 deletions src/AsyncWebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
#include <Arduino.h>
#if defined(ESP32) || defined(LIBRETUYA)
#include <AsyncTCP.h>
#ifndef WS_MAX_QUEUED_MESSAGES
#define WS_MAX_QUEUED_MESSAGES 32
#endif
#else
#include <ESPAsyncTCP.h>
#ifndef WS_MAX_QUEUED_MESSAGES
#define WS_MAX_QUEUED_MESSAGES 8
#endif
#endif
#include <ESPAsyncWebServer.h>

#include "AsyncWebSynchronization.h"
Expand Down

1 comment on commit c4ced25

@CRSLEE
Copy link

@CRSLEE CRSLEE commented on c4ced25 Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this change i cant compile my project.
if (!client->send();) return 0; -> ;

Please sign in to comment.