Skip to content

Commit

Permalink
net: replace ws_stream_wasm with wasm-ws
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Dec 16, 2023
1 parent fe6dd0a commit 7ac8a5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/nostr-sdk-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion crates/nostr-sdk-net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions crates/nostr-sdk-net/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<WsStream, WsMessage>;
type Stream = SplitStream<WsStream>;

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())
}

0 comments on commit 7ac8a5b

Please sign in to comment.