Skip to content

Commit

Permalink
Use hostname for default websocket address (#1664)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs authored Mar 22, 2023
1 parent c1cc4c9 commit 3b01e8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/re_viewer/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn get_url(info: &eframe::IntegrationInfo) -> String {
url = param.clone();
}
if url.is_empty() {
re_ws_comms::default_server_url()
re_ws_comms::default_server_url(&info.web_info.location.hostname)
} else {
url
}
Expand Down
4 changes: 2 additions & 2 deletions crates/re_ws_comms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub const PROTOCOL: &str = "wss";
#[cfg(not(feature = "tls"))]
pub const PROTOCOL: &str = "ws";

pub fn default_server_url() -> String {
format!("{PROTOCOL}://127.0.0.1:{DEFAULT_WS_SERVER_PORT}")
pub fn default_server_url(hostname: &str) -> String {
format!("{PROTOCOL}://{hostname}:{DEFAULT_WS_SERVER_PORT}")
}

const PREFIX: [u8; 4] = *b"RR00";
Expand Down
10 changes: 5 additions & 5 deletions crates/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,16 @@ async fn run_impl(

// This is the server which the web viewer will talk to:
let ws_server = re_ws_comms::Server::new(re_ws_comms::DEFAULT_WS_SERVER_PORT).await?;
let server_handle = tokio::spawn(ws_server.listen(rx, shutdown_ws_server));
let ws_server_handle = tokio::spawn(ws_server.listen(rx, shutdown_ws_server));
let ws_server_url = re_ws_comms::default_server_url("127.0.0.1");

// This is the server that serves the Wasm+HTML:
let ws_server_url = re_ws_comms::default_server_url();
let ws_server_handle =
let web_server_handle =
tokio::spawn(host_web_viewer(true, ws_server_url, shutdown_web_viewer));

// Wait for both servers to shutdown.
ws_server_handle.await?.ok();
return server_handle.await?;
web_server_handle.await?.ok();
return ws_server_handle.await?;
}

#[cfg(not(feature = "web_viewer"))]
Expand Down
2 changes: 1 addition & 1 deletion crates/rerun/src/web_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ impl RemoteViewerServer {
.await
.unwrap();
let ws_server_handle = tokio::spawn(ws_server.listen(rerun_rx, shutdown_rx_ws_server));
let ws_server_url = re_ws_comms::default_server_url("127.0.0.1");

// This is the server that serves the Wasm+HTML:
let ws_server_url = re_ws_comms::default_server_url();
let web_server_handle = tokio::spawn(host_web_viewer(
open_browser,
ws_server_url,
Expand Down

1 comment on commit 3b01e8d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 3b01e8d Previous: f5de99e Ratio
datastore/insert/batch/rects/insert 569830 ns/iter (± 5333) 565750 ns/iter (± 1982) 1.01
datastore/latest_at/batch/rects/query 1859 ns/iter (± 2) 1847 ns/iter (± 8) 1.01
datastore/latest_at/missing_components/primary 302 ns/iter (± 2) 288 ns/iter (± 0) 1.05
datastore/latest_at/missing_components/secondaries 448 ns/iter (± 0) 438 ns/iter (± 2) 1.02
datastore/range/batch/rects/query 149722 ns/iter (± 996) 152491 ns/iter (± 447) 0.98
mono_points_arrow/generate_message_bundles 44628851 ns/iter (± 2651533) 46984578 ns/iter (± 759997) 0.95
mono_points_arrow/generate_messages 125359619 ns/iter (± 1509549) 127628121 ns/iter (± 1217814) 0.98
mono_points_arrow/encode_log_msg 157053209 ns/iter (± 1184160) 157212706 ns/iter (± 1380731) 1.00
mono_points_arrow/encode_total 329909462 ns/iter (± 1872551) 334731329 ns/iter (± 1987309) 0.99
mono_points_arrow/decode_log_msg 172445624 ns/iter (± 2781824) 180281607 ns/iter (± 819219) 0.96
mono_points_arrow/decode_message_bundles 61554500 ns/iter (± 1003531) 65092819 ns/iter (± 783262) 0.95
mono_points_arrow/decode_total 228444437 ns/iter (± 2630599) 243092409 ns/iter (± 1497759) 0.94
batch_points_arrow/generate_message_bundles 325330 ns/iter (± 4377) 329965 ns/iter (± 645) 0.99
batch_points_arrow/generate_messages 6255 ns/iter (± 99) 6524 ns/iter (± 17) 0.96
batch_points_arrow/encode_log_msg 368027 ns/iter (± 4932) 363262 ns/iter (± 1260) 1.01
batch_points_arrow/encode_total 712689 ns/iter (± 14803) 716032 ns/iter (± 1848) 1.00
batch_points_arrow/decode_log_msg 347837 ns/iter (± 2897) 350690 ns/iter (± 1248) 0.99
batch_points_arrow/decode_message_bundles 2030 ns/iter (± 16) 2056 ns/iter (± 17) 0.99
batch_points_arrow/decode_total 345291 ns/iter (± 3389) 355609 ns/iter (± 1601) 0.97
arrow_mono_points/insert 6108385565 ns/iter (± 145421851) 6066394211 ns/iter (± 19624847) 1.01
arrow_mono_points/query 1789657 ns/iter (± 31119) 1833446 ns/iter (± 11222) 0.98
arrow_batch_points/insert 2639933 ns/iter (± 56891) 2713068 ns/iter (± 14734) 0.97
arrow_batch_points/query 16209 ns/iter (± 17) 16209 ns/iter (± 47) 1
arrow_batch_vecs/insert 42480 ns/iter (± 84) 43124 ns/iter (± 105) 0.99
arrow_batch_vecs/query 388406 ns/iter (± 334) 389454 ns/iter (± 412) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.