I'm trying to get started on a project that uses UDP to send requests to the serverside and recieve "live" updates from the serverside. However when I try to bind a socket to an IP address in the code for a component I get an error saying it's not allowed on this platform. How would I go about this?
#[component]
pub fn App() -> Element {
let socket = std::net::UdpSocket::bind("127.0.0.1:8080").expect("Failed to bind socket!");
rsx! {
button {
onclick: move |_| test_udp(&socket),
"BTN"
}
}
}