From 521a00ce47ab2831381d11c519922194eacb1b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Tue, 24 Jan 2017 02:15:18 +0100 Subject: [PATCH] Fixed multi-part socket for long screen data --- libesphttpd | 2 +- user/user_main.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libesphttpd b/libesphttpd index cc6e7da..1a69994 160000 --- a/libesphttpd +++ b/libesphttpd @@ -1 +1 @@ -Subproject commit cc6e7dafa72f5eec9c4eb0b450eab63e758db2cd +Subproject commit 1a699948bb07d789f827d831f3994fc1b2d962de diff --git a/user/user_main.c b/user/user_main.c index 173817e..9cc89cc 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -32,11 +32,14 @@ void screen_notifyChange() { void *data = NULL; - const int bufsiz = 256; + const int bufsiz = 512; char buff[bufsiz]; for (int i = 0; i < 20; i++) { httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &data); - cgiWebsockBroadcast("/ws/update.cgi", buff, (int)strlen(buff), (cont == HTTPD_CGI_MORE) ? WEBSOCK_FLAG_CONT : WEBSOCK_FLAG_NONE); + int flg = 0; + if (cont == HTTPD_CGI_MORE) flg |= WEBSOCK_FLAG_MORE; + if (i > 0) flg |= WEBSOCK_FLAG_CONT; + cgiWebsockBroadcast("/ws/update.cgi", buff, (int)strlen(buff), flg); if (cont == HTTPD_CGI_DONE) break; } } @@ -66,7 +69,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token return HTTPD_CGI_DONE; } - const int bufsiz = 256; + const int bufsiz = 512; char buff[bufsiz]; if (streq(token, "screenData")) {