Crate websockets

Source
Expand description

A WebSocket client implementation.

github crates.io docs.rs

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 Frames.

§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.
WebSocketBuilder
A builder used to customize the WebSocket handshake.
WebSocketReadHalf
The read half of a WebSocket connection, generated from WebSocket::split(). This half can only receive frames.
WebSocketWriteHalf
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.
WebSocketError
The possible error types from the WebSocket connection.