Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/web/src/devtools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ pub(crate) fn init(config: &crate::Config) -> UnboundedReceiver<HotReloadMsg> {
fn make_ws(tx: UnboundedSender<HotReloadMsg>, poll_interval: i32, reload: bool) {
// Get the location of the devserver, using the current location plus the /_dioxus path
// The idea here being that the devserver is always located on the /_dioxus behind a proxy
let location = web_sys::window().unwrap().location();
let mut location =
web_sys::Url::new(&web_sys::window().unwrap().location().href().unwrap()).unwrap();
if location.protocol().ends_with("-extension:") {
location = web_sys::Url::new("http://localhost:8080").unwrap();
}
let url = format!(
"{protocol}//{host}/_dioxus?build_id={build_id}",
protocol = match location.protocol().unwrap() {
protocol = match location.protocol() {
prot if prot == "https:" => "wss:",
_ => "ws:",
},
host = location.host().unwrap(),
host = location.host(),
build_id = dioxus_cli_config::build_id(),
);

Expand Down
Loading