Fixed multi-part socket for long screen data

pull/30/head
Ondřej Hruška 8 years ago
parent ca93a3b90d
commit 521a00ce47
  1. 2
      libesphttpd
  2. 9
      user/user_main.c

@ -1 +1 @@
Subproject commit cc6e7dafa72f5eec9c4eb0b450eab63e758db2cd Subproject commit 1a699948bb07d789f827d831f3994fc1b2d962de

@ -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")) {

Loading…
Cancel
Save