From 7ac8a5b75e12dcb0e4b5cb13de5b92250eed2300 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Sat, 16 Dec 2023 19:32:52 +0100 Subject: [PATCH] net: replace `ws_stream_wasm` with `wasm-ws` --- Cargo.lock | 4 +++- crates/nostr-sdk-net/Cargo.toml | 2 +- crates/nostr-sdk-net/src/lib.rs | 2 +- crates/nostr-sdk-net/src/wasm.rs | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe9fcc94a..2e2509051 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2953,7 +2953,9 @@ dependencies = [ [[package]] name = "wasm-ws" -version = "0.7.4" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601c6f6340b473083c38e6cdda1f39dfc35d67b0e4b54fa56624d6189c2aa366" dependencies = [ "async_io_stream", "futures", diff --git a/crates/nostr-sdk-net/Cargo.toml b/crates/nostr-sdk-net/Cargo.toml index aca76f1f0..9c0823af5 100644 --- a/crates/nostr-sdk-net/Cargo.toml +++ b/crates/nostr-sdk-net/Cargo.toml @@ -24,4 +24,4 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } webpki-roots = "0.25" [target.'cfg(target_arch = "wasm32")'.dependencies] -ws_stream_wasm = "0.7" +wasm-ws = "0.1" diff --git a/crates/nostr-sdk-net/src/lib.rs b/crates/nostr-sdk-net/src/lib.rs index eaa105a05..4b0dd96b1 100644 --- a/crates/nostr-sdk-net/src/lib.rs +++ b/crates/nostr-sdk-net/src/lib.rs @@ -16,4 +16,4 @@ pub mod wasm; #[cfg(not(target_arch = "wasm32"))] pub use self::native::Message as WsMessage; #[cfg(target_arch = "wasm32")] -pub use ws_stream_wasm::WsMessage; +pub use wasm_ws::WsMessage; diff --git a/crates/nostr-sdk-net/src/wasm.rs b/crates/nostr-sdk-net/src/wasm.rs index 46daa40d4..0807d3841 100644 --- a/crates/nostr-sdk-net/src/wasm.rs +++ b/crates/nostr-sdk-net/src/wasm.rs @@ -7,12 +7,12 @@ use futures_util::stream::{SplitSink, SplitStream}; use futures_util::StreamExt; use url_fork::Url; -use ws_stream_wasm::{WsErr, WsMessage, WsMeta, WsStream}; +use wasm_ws::{WebSocket, WsErr, WsMessage, WsStream}; type Sink = SplitSink; type Stream = SplitStream; pub async fn connect(url: &Url) -> Result<(Sink, Stream), WsErr> { - let (_ws, stream) = WsMeta::connect(url, None).await?; + let (_ws, stream) = WebSocket::connect(url).await?; Ok(stream.split()) }