Expand description
This module implements WebSocket support for Dioxus Fullstack applications.
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 module implements a variety of types:
Websocket<In, Out, E>: Represents a WebSocket connection that can send messages of typeInand receive messages of typeOut, using the encodingE.UseWebsocket<In, Out, E>: A hook that provides a reactive interface to a WebSocket connection.WebSocketOptions: Configuration options for establishing a WebSocket connection.TypedWebsocket<In, Out, E>: A typed wrapper around an Axum WebSocket connection for server-side use.WebsocketState: An enum representing the state of the WebSocket connection.- plus a variety of error types and traits for encoding/decoding messages.
Dioxus Fullstack websockets are typed in both directions, letting the happy path (.send() and .recv())
automatically serialize and deserialize messages for you.
Structs§
- UseWebsocket
- The return type of the
use_websockethook. - WebSocket
Options - Websocket
- A WebSocket connection that can send and receive messages of type
InandOut.
Enums§
- Close
Code - Status code used to indicate why an endpoint is closing the
WebSocketconnection.1 - Message
- A
WebSocketmessage, which can be a text string or binary data. - Websocket
Error - Websocket
State
Functions§
- use_
websocket - A hook that provides a reactive interface to a WebSocket connection.