Skip to content

Commit

Permalink
Checkpointing: have a chat UI setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkulshreshtha committed Sep 6, 2024
1 parent 88db94f commit a64a0a6
Show file tree
Hide file tree
Showing 9 changed files with 370 additions and 46 deletions.
229 changes: 228 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion hydroflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ serde_json = "1.0.115"
slotmap = "1.0.0"
smallvec = "1.6.1"
tokio-stream = { version = "0.1.3", default-features = false, features = [ "time", "io-util", "sync" ] }
tokio-tungstenite = "0.23.1"
tokio-tungstenite = { version = "0.23.1", optional = true }
tracing = "0.1.37"
variadics = { path = "../variadics", version = "^0.0.6" }
web-time = "1.0.0"
Expand All @@ -74,6 +74,7 @@ tokio-util = { version = "0.7.5", features = [ "net", "codec" ] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { version = "1.29.0", features = [ "rt" , "sync", "macros", "io-util", "time" ] }
tokio-util = { version = "0.7.5", features = [ "codec" ] }
wasm-bindgen-futures = "0.4.43"
# We depend on getrandom transitively through rand. To compile getrandom to
# WASM, we need to enable its "js" feature. However, rand does not expose a
# passthrough to enable "js" on getrandom. As a workaround, we enable the
Expand Down
1 change: 1 addition & 0 deletions hydroflow/src/scheduled/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl Context {
for task in self.tasks_to_spawn.drain(..) {
self.task_join_handles.push(tokio::task::spawn_local(task));
}

}

/// Aborts all tasks spawned with [`Self::spawn_tasks`].
Expand Down
3 changes: 3 additions & 0 deletions hydroflow/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ pub use socket::*;

#[cfg(feature = "deploy_integration")]
pub mod deploy;

#[cfg(not(target_arch = "wasm32"))]
mod websocket;
#[cfg(not(target_arch = "wasm32"))]
pub use websocket::*;

use std::io::Read;
Expand Down
1 change: 1 addition & 0 deletions hydroflow/src/util/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tokio_tungstenite::tungstenite::{Error, Message};
use crate::util::unsync::mpsc::{Receiver, Sender};
use crate::util::unsync_channel;


pub async fn bind_websocket(endpoint: SocketAddr) -> Result<(Sender<(Message, SocketAddr)>, Receiver<Result<(Message, SocketAddr), Error>>, SocketAddr), std::io::Error>{
let listener = TcpListener::bind(endpoint).await.unwrap();

Expand Down
4 changes: 3 additions & 1 deletion wasm_test_site/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ edition = "2018"
crate-type = ["cdylib", "rlib"]

[dependencies]
gloo = { version = "0.11.0", features = ["futures"] }
hydroflow = { path = "../hydroflow" }
wasm-bindgen = "0.2.84"
wasm-bindgen-futures = "0.4.43"
web-sys = { version = "0.3.51", features = [ "console" ] }
web-sys = { version = "0.3.51", features = [ "console", "Window", "Document", "Element", "HtmlElement", "HtmlInputElement", "EventTarget"] }

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = "0.1.7"
futures = "0.3.30"

[dev-dependencies]
wasm-bindgen-test = "0.3.34"
Expand Down
Loading

0 comments on commit a64a0a6

Please sign in to comment.