From 5bd37d8fd2118463a97456395728a418c2125010 Mon Sep 17 00:00:00 2001 From: Nicolas Favre-Felix Date: Sat, 5 Oct 2024 12:21:10 -0700 Subject: [PATCH] Add HGETALL to the WebSocket HTML demo Quick demo to answer a question asked in GitHub issue #249: https://github.com/nicolasff/webdis/issues/249 --- tests/websocket.html | 18 ++++++++++++++++++ webdis.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/websocket.html b/tests/websocket.html index 6ce1962..3743c64 100644 --- a/tests/websocket.html +++ b/tests/websocket.html @@ -101,6 +101,16 @@

$TITLE

+
+
+
+
 
+
+
+
+
+
+
@@ -190,6 +200,12 @@

$TITLE

this.send(serialized); }); + $(`${this.type}-btn-hgetall`).addEventListener('click', event => { + event.preventDefault(); + const serialized = this.serializer(['HGETALL', $(`${this.type}-hgetall-key`).value]); + this.send(serialized); + }); + $(`${this.type}-btn-pub`).addEventListener('click', event => { event.preventDefault(); const serialized = this.serializer(['PUBLISH', $(`${this.type}-pub-channel`).value, $(`${this.type}-pub-message`).value]); @@ -236,6 +252,8 @@

$TITLE

$(`${this.type}-btn-set`).disabled = !connected || this.subscribed; $(`${this.type}-get-key`).disabled = !connected || this.subscribed; $(`${this.type}-btn-get`).disabled = !connected || this.subscribed; + $(`${this.type}-btn-hgetall`).disabled = !connected || this.subscribed; + $(`${this.type}-hgetall-key`).disabled = !connected || this.subscribed; $(`${this.type}-pub-channel`).disabled = !connected || this.subscribed; $(`${this.type}-pub-message`).disabled = !connected || this.subscribed; $(`${this.type}-btn-pub`).disabled = !connected || this.subscribed; diff --git a/webdis.json b/webdis.json index 923c3b9..5f46332 100644 --- a/webdis.json +++ b/webdis.json @@ -10,7 +10,7 @@ "pool_size": 20, "daemonize": false, - "websockets": false, + "websockets": true, "database": 0,