Crate websockets[][src]

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

Types used to customize a secure WebSocket connection; used as arguments to methods on the WebSocketBuilder.

Structs

Manages the WebSocket connection; used to connect, send data, and receive data.

A builder used to customize the WebSocket handshake.

The read half of a WebSocket connection, generated from WebSocket::split(). This half can only receive frames.

The write half of a WebSocket connection, generated from WebSocket::split(). This half can only send frames.

Enums

Data which is sent and received through the WebSocket connection.

The possible error types from the WebSocket connection.