Skip to content

Commit aedcd51

Browse files
committed
Revert "feat: add default "auto" live reload protocol option (#4224)"
This reverts commit a97ecea.
1 parent 9160d8a commit aedcd51

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

leptos/src/hydration/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn AutoReload(
2727
None => options.reload_port,
2828
};
2929
let protocol = match options.reload_ws_protocol {
30-
leptos_config::ReloadWSProtocol::Auto => "null",
3130
leptos_config::ReloadWSProtocol::WS => "'ws://'",
3231
leptos_config::ReloadWSProtocol::WSS => "'wss://'",
3332
};

leptos/src/hydration/reload_script.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
let host = window.location.hostname;
2-
3-
if (protocol === null) {
4-
protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
5-
}
6-
72
let ws = new WebSocket(`${protocol}${host}:${reload_port}/live_reload`);
83
ws.onmessage = (ev) => {
94
let msg = JSON.parse(ev.data);

leptos_config/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl LeptosOptions {
153153
None => None,
154154
},
155155
reload_ws_protocol: ws_from_str(
156-
env_w_default("LEPTOS_RELOAD_WS_PROTOCOL", "auto")?.as_str(),
156+
env_w_default("LEPTOS_RELOAD_WS_PROTOCOL", "ws")?.as_str(),
157157
)?,
158158
not_found_path: env_w_default("LEPTOS_NOT_FOUND_PATH", "/404")?
159159
.into(),
@@ -283,24 +283,22 @@ impl TryFrom<String> for Env {
283283
pub enum ReloadWSProtocol {
284284
WS,
285285
WSS,
286-
Auto,
287286
}
288287

289288
impl Default for ReloadWSProtocol {
290289
fn default() -> Self {
291-
Self::Auto
290+
Self::WS
292291
}
293292
}
294293

295294
fn ws_from_str(input: &str) -> Result<ReloadWSProtocol, LeptosConfigError> {
296295
let sanitized = input.to_lowercase();
297296
match sanitized.as_ref() {
298-
"auto" => Ok(ReloadWSProtocol::Auto),
299297
"ws" | "WS" => Ok(ReloadWSProtocol::WS),
300298
"wss" | "WSS" => Ok(ReloadWSProtocol::WSS),
301299
_ => Err(LeptosConfigError::EnvVarError(format!(
302-
"{input} is not a supported websocket protocol. Use only `auto`, \
303-
`ws` or `wss`.",
300+
"{input} is not a supported websocket protocol. Use only `ws` or \
301+
`wss`.",
304302
))),
305303
}
306304
}

0 commit comments

Comments
 (0)