diff --git a/src/public/index.html b/src/public/index.html
index 677c5fb..9623c06 100644
--- a/src/public/index.html
+++ b/src/public/index.html
@@ -86,6 +86,8 @@
print(data.Text);
} else if (data.QuietText) {
print(data.QuietText);
+ } else if (data.Typing) {
+ print("(someone is typing...)")
}
}
function ws_onerror(evt) {
@@ -131,6 +133,21 @@
}
return false;
};
+
+ var typing_clear_timeout = 0;
+ input.onkeyup = function() {
+ if (input.value) {
+ if (!typing_clear_timeout) {
+ ws.send(`{"Typing":true}`);
+ } else {
+ clearTimeout(typing_clear_timeout);
+ }
+ typing_clear_timeout = setTimeout(() => {
+ ws.send(`{"Typing":false}`);
+ typing_clear_timeout = 0;
+ }, 3000);
+ }
+ };
});