Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Websocket Lag #81

Merged
merged 2 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,16 @@ function wsProcessQueue() {
} else {
//set wsBusy flag that we are waiting for a response
wsBusy=true;
//set timeout to clear flag and try next message if response isn't recieved
wsTimerId=setTimeout(wsReadyToSend,2000);
//get next message from queue and send it.
//get next message from queue.
message=wsQueue.shift();
//set timeout to clear flag and try next message if response isn't recieved. Short timeout for message types that don't generate a response.
if(['T0','T1','T2','T3','X6'].indexOf(message.substr(0,2))) {
timeout=40;
} else {
timeout=2000;
}
wsTimerId=setTimeout(wsReadyToSend,timeout);
//send it.
console.log('WS sending ' + message);
ws.send(message);
}
Expand Down
4 changes: 4 additions & 0 deletions wshandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ extern bool reboot; // Reboot flag

T0 - Disable Testing
T1 - Static Testing
T2 - Chase Test
T3 - Rainbow Test
T4 - View Stream

S1 - Set Network Config
S2 - Set Device Config

X1 - Get RSSI
X2 - Get E131 Status
Xh - Get Heap
XU - Get Uptime
X6 - Reboot
*/

Expand Down