mirror of
https://github.com/s00500/ESPUI.git
synced 2025-07-04 06:10:18 +00:00
Further improve the reliability of UI element transfer.
A protocol has been implemented between the server and client to acknowledge each UI_INITIAL_GUI and UI_EXTEND_GUI from the client javascript. This prevents the internal websocket buffers from becoming flooded when the number of controls gets too high.
This commit is contained in:
12
data/js/controls.js
vendored
12
data/js/controls.js
vendored
@ -252,6 +252,13 @@ function start() {
|
||||
};
|
||||
handleEvent(fauxEvent);
|
||||
});
|
||||
|
||||
//If there are more elements in the complete UI, then request them
|
||||
//Note: we subtract 1 from data.controls.length because the controls always
|
||||
//includes the title element
|
||||
if(data.totalcontrols > (data.controls.length - 1)) {
|
||||
websock.send("uiok:" + (data.controls.length - 1));
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_EXTEND_GUI:
|
||||
@ -261,6 +268,11 @@ function start() {
|
||||
};
|
||||
handleEvent(fauxEvent);
|
||||
});
|
||||
|
||||
//Do we need to keep requesting more UI elements?
|
||||
if(data.totalcontrols > data.startindex + (data.controls.length - 1)) {
|
||||
websock.send("uiok:" + (data.startindex + (data.controls.length - 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_RELOAD:
|
||||
|
Reference in New Issue
Block a user