Skip to content

Commit 2acadbd

Browse files
committed
AsyncWebSocket: Add debug prints
1 parent 16a926d commit 2acadbd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/AsyncWebSocket.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
#include <Hash.h>
3030
#endif
3131

32-
#define MAX_PRINTF_LEN 64
32+
#ifdef ASYNCWEBSERVER_DEBUG_TRACE
33+
#define DEBUG_PRINTFP(fmt, ...) Serial.printf_P(PSTR("[%d]{%d}" fmt "\n"), millis(), ESP.getFreeHeap(), ##__VA_ARGS__)
34+
#else
35+
#define DEBUG_PRINTFP(...)
36+
#endif
3337

38+
#define MAX_PRINTF_LEN 64
3439
#define MAX_HEADER_SIZE 8
3540

3641
// Return a guess at the maximum packet size we can send
@@ -200,6 +205,7 @@ AsyncWebSocketBasicMessage::~AsyncWebSocketBasicMessage() {
200205
}
201206
}
202207
size_t AsyncWebSocketBasicMessage::send(AsyncClient *client) {
208+
DEBUG_PRINTFP("BasicMessage %d - %d (%d/%d/%d - %d/%d)", (intptr_t) this, _status, _sent, _attempted, _len, _acked, _ack);
203209
if(_status != WS_MSG_SENDING)
204210
return 0;
205211
if(_acked < _ack){
@@ -297,6 +303,7 @@ AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage() {
297303
//ets_printf("A: %u\n", len);
298304
}
299305
size_t AsyncWebSocketMultiMessage::send(AsyncClient *client) {
306+
DEBUG_PRINTFP("MultiMessage %d - %d (%d/%d/%d - %d/%d)", (intptr_t) this, _status, _sent, _attempted, _WSbuffer.size(), _acked, _ack);
300307
if(_status != WS_MSG_SENDING)
301308
return 0;
302309
if(_acked < _ack){

0 commit comments

Comments
 (0)