Fixed multi-part socket for long screen data

This commit is contained in:
2017-01-24 02:15:18 +01:00
parent ca93a3b90d
commit 521a00ce47
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -32,11 +32,14 @@ void screen_notifyChange() {
void *data = NULL; void *data = NULL;
const int bufsiz = 256; const int bufsiz = 512;
char buff[bufsiz]; char buff[bufsiz];
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &data); 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; 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; return HTTPD_CGI_DONE;
} }
const int bufsiz = 256; const int bufsiz = 512;
char buff[bufsiz]; char buff[bufsiz];
if (streq(token, "screenData")) { if (streq(token, "screenData")) {