From df09a163e5706ac46a29c9def0ab0243ac37093f Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Wed, 6 Nov 2024 11:40:40 +0100 Subject: [PATCH] feat(web-keyvalue): add Redis support Signed-off-by: Roman Volosatovs --- Cargo.lock | 1 + examples/web/rust/Cargo.toml | 1 + examples/web/rust/index.html | 29 +++++++++++++++---- examples/web/rust/src/main.rs | 53 ++++++++++++++++++++--------------- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a51d96c..6d32c65d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4229,6 +4229,7 @@ dependencies = [ "wrpc-transport-web", "wrpc-wasi-keyvalue", "wrpc-wasi-keyvalue-mem", + "wrpc-wasi-keyvalue-redis", "wtransport", ] diff --git a/examples/web/rust/Cargo.toml b/examples/web/rust/Cargo.toml index b9d08d48..9b1377ed 100644 --- a/examples/web/rust/Cargo.toml +++ b/examples/web/rust/Cargo.toml @@ -57,4 +57,5 @@ wrpc-transport-quic = { workspace = true } wrpc-transport-web = { workspace = true } wrpc-wasi-keyvalue = { workspace = true } wrpc-wasi-keyvalue-mem = { workspace = true } +wrpc-wasi-keyvalue-redis = { workspace = true } wtransport = { workspace = true, features = ["self-signed"] } diff --git a/examples/web/rust/index.html b/examples/web/rust/index.html index aabf369f..0bb2a0c7 100644 --- a/examples/web/rust/index.html +++ b/examples/web/rust/index.html @@ -32,7 +32,7 @@ } else if (conn === 'nats') { let addr = obj['nats-addr']; if (addr == null || addr === '') { - alert("NATS.io server URL must be set"); + alert("NATS.io server address must be set"); return } identifier = 'wrpc+nats://' + addr; @@ -46,6 +46,13 @@ if (bucket != null && bucket != '') { identifier = identifier + ";" + bucket; } + } else if (conn === 'redis') { + let url = obj['redis-url']; + if (url == null || url === '') { + alert("Redis URL must be set"); + return + } + identifier = url; } else if (conn === 'quic') { let addr = obj.addr; if (addr == null || addr === '') { @@ -318,11 +325,12 @@

wRPC WebTransport demo

@@ -351,6 +359,15 @@

wRPC WebTransport demo

+ +