pub fn use_websocket<In: 'static, Out: 'static, E: Into<CapturedError> + 'static, F: Future<Output = Result<Websocket<In, Out, Enc>, E>> + 'static, Enc: Encoding>(
connect_to_websocket: impl FnMut() -> F + 'static,
) -> UseWebsocket<In, Out, Enc>Expand description
A hook that provides a reactive interface to a WebSocket connection.
WebSockets provide a full-duplex communication channel over a single, long-lived connection.
This makes them ideal for real-time applications where the server and the client need to communicate frequently and with low latency. Unlike Server-Sent Events (SSE), WebSockets allow the direct transport of binary data, enabling things like video and audio streaming as well as more efficient zero-copy serialization formats.
This hook takes a function that returns a future which resolves to a Websocket<In, Out, E> -
usually a server function.