Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Switch from tungstenite-rs to tokio-tungstenite
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Jan 13, 2020
1 parent 6aa8b0e commit f298f18
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 60 deletions.
112 changes: 112 additions & 0 deletions Cargo.lock

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

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ indicatif = "0.13.0"
hyper = "0.13.1"
hyper-tls = "0.4.0"
chrono = "0.4.9"
tokio = "0.2.0"
tokio = {version = "0.2", default-features = false, features = ["io-util", "io-std", "macros"]}
# chrome-devtools-rs = { path = "../chrome-devtools-rs" }
chrome-devtools-rs = { git = "https://github.com/everlastingbugstopper/chrome-devtools-rs", rev = "b7a0e9f" }
ws = "0.9.0"
futures = "0.3"
futures-util = "0.3"
tungstenite = {version = "0.9.2", default-features = false}

[dependencies.tungstenite]
version = "0.9.2"
[dependencies.tokio-tungstenite]
git = "https://github.com/snapview/tokio-tungstenite"
rev = "adb4f43"
features = ["tls"]

[dev-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion src/commands/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub fn dev(
let preview_id = get_preview_id(target, user, &server_config, &session_id)?;

// create a new thread to listen for devtools messages
thread::spawn(move || socket::listen(session_id));
thread::spawn(move || {
let mut runtime = TokioRuntime::new().unwrap();
runtime.block_on(socket::listen(session_id)).unwrap();
});

// spawn tokio runtime on the main thread to handle incoming HTTP requests
let mut runtime = TokioRuntime::new()?;
Expand Down
Loading

0 comments on commit f298f18

Please sign in to comment.