Skip to content

Commit 3e75043

Browse files
committed
change example to use tokio::spawn again
1 parent 2b0a64f commit 3e75043

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ web-sys = { version = "0.3", features = ["WebSocket", "CloseEvent", "ErrorEvent"
4141
wasm-bindgen-futures = "0.4"
4242

4343
[dev-dependencies]
44-
tokio = { version = "1", features = ["macros", "rt"] }
44+
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
4545
reqwest = { version = "0.12", features = ["default-tls"] }
4646
serde = { version = "1.0", features = ["derive"] }
4747

examples/hello_world.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use futures_util::{SinkExt, StreamExt, TryStreamExt};
22
use reqwest::Client;
33
use reqwest_websocket::{Error, Message, RequestBuilderExt};
44

5-
#[tokio::main(flavor = "current_thread")]
5+
#[tokio::main]
66
async fn main() -> Result<(), Error> {
77
let websocket = Client::default()
88
.get("wss://echo.websocket.org/")
@@ -14,7 +14,7 @@ async fn main() -> Result<(), Error> {
1414

1515
let (mut tx, mut rx) = websocket.split();
1616

17-
tokio::task::spawn_local(async move {
17+
tokio::spawn(async move {
1818
for i in 1..11 {
1919
tx.send(Message::Text(format!("Hello, World! #{i}")))
2020
.await

0 commit comments

Comments
 (0)