[![Documentation](https://docs.rs/wtransport/badge.svg)](https://docs.rs/wtransport/) [![Crates.io](https://img.shields.io/crates/v/wtransport.svg)](https://crates.io/crates/wtransport) [![CI](https://github.com/BiagioFesta/wtransport/actions/workflows/ci.yml/badge.svg)](https://github.com/BiagioFesta/wtransport/actions/workflows/ci.yml) [![Chat](https://img.shields.io/badge/chat-join-blue?logo=discord)](https://discord.gg/KPrrbWe5zg) # WTransport [WebTransport](https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3/) protocol, pure-*rust*, *async*-friendly. ## Introduction WebTransport is a new protocol being developed to enable *low-latency*, *bidirectional* communication between clients and servers over the web. It aims to address the limitations of existing protocols like *HTTP* and *WebSocket* by offering a more *efficient* and *flexible* transport layer. ### Benefits of WebTransport * 🚀 **Low latency**: WebTransport is designed to minimize latency, making it suitable for real-time applications such as gaming, video streaming, and collaborative editing. * 🔄 **Bidirectional communication**: WebTransport allows simultaneous data exchange between the client and server, enabling efficient back-and-forth communication without the need for multiple requests. * 🔀 **Multiplexing**: With WebTransport, multiple streams can be multiplexed over a single connection, reducing overhead and improving performance. * 🔒 **Security**: WebTransport benefits from the security features provided by the web platform, including transport encryption and same-origin policy. * 🌐 **Native Browser Support**: WebTransport is natively supported in modern web browsers, ensuring seamless integration and enhanced performance for web applications. ### Notes Please be aware that WebTransport is still a *draft* and not yet standardized. The *WTransport* library, while functional, is not considered completely production-ready. It should be used with caution and may undergo changes as the WebTransport specification evolves. ## Simple API
Server | Client |
---|---|
```rust #[tokio::main] async fn main() -> Result<()> { let config = ServerConfig::builder() .with_bind_default(4433) .with_identity(&identity) .build(); let connection = Endpoint::server(config)? .accept() .await // Awaits connection .await? // Awaits session request .accept() // Accepts request .await?; // Awaits ready session let stream = connection.accept_bi().await?; // ... } ``` | ```rust #[tokio::main] async fn main() -> Result<()> { let config = ClientConfig::default(); let connection = Endpoint::client(config)? .connect("https://[::1]:4433") .await?; let stream = connection.open_bi().await?.await?; // ... } ``` |