Expand description
A WebSocket client implementation.
use websockets::WebSocket;
let mut ws = WebSocket::connect("wss://echo.websocket.org/").await?;
ws.send_text("foo".to_string()).await?;
ws.receive().await?;
ws.close(None).await?;
§Features
- Simple API
- Async/await (tokio runtime)
- TLS support (automatically detected)
§Usage
The WebSocket
type manages the WebSocket connection.
Use it to connect, send, and receive data.
Data is sent and received through Frame
s.
§License
This project is licensed under the MIT license.
Modules§
- secure
- Types used to customize a secure WebSocket connection; used as arguments to
methods on the
WebSocketBuilder
.
Structs§
- WebSocket
- Manages the WebSocket connection; used to connect, send data, and receive data.
- WebSocket
Builder - A builder used to customize the WebSocket handshake.
- WebSocket
Read Half - The read half of a WebSocket connection, generated from
WebSocket::split()
. This half can only receive frames. - WebSocket
Write Half - The write half of a WebSocket connection, generated from
WebSocket::split()
. This half can only send frames.
Enums§
- Frame
- Data which is sent and received through the WebSocket connection.
- WebSocket
Error - The possible error types from the WebSocket connection.