#Websockets not connecting on ws protocol
1 messages · Page 1 of 1 (latest)
the goal is to have a webserver dynamically serve files from unknown paths within a set folder, so that users can create a custom frontend with a custom name (see https://github.com/l3lackShark/gosumemory)
but reserve /ws/ for websocket communication
#[actix_web::main]
pub async fn spawn_server(settings: Settings) -> std::io::Result<()> {
let address = ("127.0.0.1", settings.read_config::<u16>("port")); // the address is a tuple
let wrapper = NormalizePath::new(TrailingSlash::Always).use_redirects();
let server = HttpServer::new(move || App::new().route("/ws", web::get().to(websocket_connect)))
.bind(address)?
.run();
let (ip, port) = address;
match open::that(format!("http://{}:{}", ip, port)) {
Ok(_) => {}
Err(error) => error::handle_error("Failed to open overlay in browser!", error),
}
server.await
}
this seems to work
but I'm not serving files