[−][src]Crate websockets
A WebSocket client implementation.
use websockets::{WebSocket, WebSocketError}; #[tokio::main] async fn main() { let mut ws = WebSocket::connect("wss://echo.websocket.org/").await.unwrap(); ws.send_text("foo".to_string(), false, true).await.unwrap(); ws.receive().await.unwrap(); ws.close(None).await.unwrap(); }
Usage
The WebSocket
type manages the WebSocket connection.
Use it to connect, send, and receive data.
Data is sent and received through Frame
s.
See these types for additional information on how to use them.
Structs
WebSocket | Manages the WebSocket connection; used to connect, send data, and receive data. |
WebSocketBuilder | A builder used to customize the WebSocket handshake. |
Enums
Frame | Data which is sent and received through the WebSocket connection. |
WebSocketError | The possible error types from the WebSocket connection. |