pub fn refresh_page() {
    let location = web_sys::window()
        .unwrap()
        .document()
        .unwrap()
        .location()
        .unwrap();

    location.reload().unwrap();
}

pub fn get_ws_url() -> String {
    let location = web_sys::window()
        .unwrap()
        .document()
        .unwrap()
        .location()
        .unwrap();

    let protocol = if location.protocol().unwrap() == "https" {
        "wss"
    } else {
        "ws"
    };

    format!("{}://{}/ws", protocol, location.host().unwrap())
}
