Skip to content

Commit

Permalink
build: upgrade tungstenite-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
jost-s committed Apr 16, 2024
1 parent 28ae7e8 commit 8826ae2
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 97 deletions.
116 changes: 38 additions & 78 deletions Cargo.lock

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

17 changes: 13 additions & 4 deletions crates/trycp_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,30 @@ keywords = ["holochain", "holo", "p2p", "network", "simulation"]
homepage = "https://github.com/holochain/tryorama"
documentation = "https://github.com/holochain/tryorma/crates/trycp_server"
repository = "https://github.com/holochain/tryorma"
authors = [ "Holochain Core Dev Team <[email protected]>" ]
authors = ["Holochain Core Dev Team <[email protected]>"]
edition = "2021"

[dependencies]
futures = "0.3"
nix = { version = "0.28", features = ["signal"] }
once_cell = "1.5.0"
parking_lot = "0.12"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls-tls-native-roots"] }
reqwest = { version = "0.11", default-features = false, features = [
"blocking",
"json",
"rustls-tls-native-roots",
] }
rmp-serde = "=0.15.5"
serde = { version = "1.0.181", features = ["derive"] }
serde_bytes = "0.11"
slab = "0.4"
snafu = "0.6"
structopt = "0.2"
tokio = { version = "1.24", features = ["macros", "rt-multi-thread", "process", "fs"]}
tokio-tungstenite = "0.14"
tokio = { version = "1.24", features = [
"macros",
"rt-multi-thread",
"process",
"fs",
] }
tokio-tungstenite = "0.21"
url = "2"
15 changes: 8 additions & 7 deletions crates/trycp_server/src/admin_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use snafu::{OptionExt, ResultExt, Snafu};
use tokio::time::error::Elapsed;
use tokio_tungstenite::tungstenite::{
self,
handshake::client::Request,
client::IntoClientRequest,
protocol::{frame::coding::CloseCode, CloseFrame, WebSocketConfig},
Message,
};
Expand Down Expand Up @@ -35,12 +35,13 @@ pub(crate) async fn admin_call(id: String, message: Vec<u8>) -> Result<Vec<u8>,
.await
.context(TcpConnect)?;
let uri = format!("ws://{}", addr);
let request = Request::builder()
.uri(uri.clone())
// needed for admin websocket connection to be accepted
.header("origin", "trycp-admin")
.body(())
.expect("request to be valid");
let mut request = uri.clone().into_client_request().expect("not a valid URI");
// needed for admin websocket connection to be accepted
request.headers_mut().insert(
"origin",
"trycp-admin".parse().expect("invalid origin header value"),
);
request.body();

println!("Establishing admin interface with {:?}", uri);

Expand Down
17 changes: 10 additions & 7 deletions crates/trycp_server/src/app_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures::{future, SinkExt, StreamExt, TryStreamExt};
use once_cell::sync::Lazy;
use slab::Slab;
use snafu::{IntoError, OptionExt, ResultExt, Snafu};
use tokio_tungstenite::tungstenite::handshake::client::Request;
use tokio_tungstenite::tungstenite::client::IntoClientRequest;
use tokio_tungstenite::tungstenite::protocol::WebSocketConfig;
use tokio_tungstenite::tungstenite::{self, protocol::CloseFrame};
use tokio_tungstenite::tungstenite::{protocol::frame::coding::CloseCode, Message};
Expand Down Expand Up @@ -53,12 +53,15 @@ pub(crate) async fn connect(
.await
.context(TcpConnect)?;
let uri = format!("ws://{}", addr);
let request = Request::builder()
.uri(uri.clone())
// needed for admin websocket connection to be accepted
.header("origin", "tryorama-interface")
.body(())
.expect("request to be valid");
let mut request = uri.clone().into_client_request().expect("not a valid URI");
// needed for app websocket connection to be accepted
request.headers_mut().insert(
"origin",
"tryorama-interface"
.parse()
.expect("invalid origin header value"),
);
request.body();

println!("Establishing app interface with {:?}", uri);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@holochain/client": "^0.17.0-dev.9",
"@holochain/client": "^0.17.0-dev.8",
"get-port": "^6.1.2",
"lodash": "^4.17.21",
"uuid": "^8.3.2",
Expand Down

0 comments on commit 8826ae2

Please sign in to comment.