#websocket #io #web #tokio #async-std

async-tungstenite

Async binding for Tungstenite, the Lightweight stream-based WebSocket implementation

19 releases (9 breaking)

0.10.0 Oct 22, 2020
0.8.0 Jul 27, 2020
0.4.2 Mar 25, 2020
0.2.1 Dec 12, 2019
0.2.0 Nov 29, 2019

#3 in WebSocket

Download history 7294/week @ 2020-08-04 8694/week @ 2020-08-11 7254/week @ 2020-08-18 6865/week @ 2020-08-25 6065/week @ 2020-09-01 7443/week @ 2020-09-08 10264/week @ 2020-09-15 9531/week @ 2020-09-22 10406/week @ 2020-09-29 9586/week @ 2020-10-06 10600/week @ 2020-10-13 10535/week @ 2020-10-20 9676/week @ 2020-10-27 10197/week @ 2020-11-03 10701/week @ 2020-11-10 8923/week @ 2020-11-17

35,531 downloads per month
Used in 59 crates (35 directly)

MIT license

78KB
1.5K SLoC

async-tungstenite

Asynchronous WebSockets for async-std, tokio, gio and any std Futures runtime.

MIT licensed Crates.io Build Status

Documentation

Usage

Add this in your Cargo.toml:

[dependencies]
async-tungstenite = "*"

Take a look at the examples/ directory for client and server examples. You may also want to get familiar with async-std or tokio if you don't have any experience with it.

What is async-tungstenite?

This crate is based on tungstenite Rust WebSocket library and provides async bindings and wrappers for it, so you can use it with non-blocking/asynchronous TcpStreams from and couple it together with other crates from the async stack. In addition, optional integration with various other crates can be enabled via feature flags

  • async-tls: Enables the async_tls module, which provides integration with the async-tls TLS stack and can be used independent of any async runtime.
  • async-std-runtime: Enables the async_std module, which provides integration with the async-std runtime.
  • async-native-tls: Enables the additional functions in the async_std module to implement TLS via async-native-tls.
  • tokio-runtime: Enables the tokio module, which provides integration with the tokio runtime.
  • tokio-native-tls: Enables the additional functions in the tokio module to implement TLS via tokio-native-tls.
  • tokio-rustls: Enables the additional functions in the tokio module to implement TLS via tokio-rustls.
  • gio-runtime: Enables the gio module, which provides integration with the gio runtime.

tokio-tungstenite

Originally this crate was created as a fork of tokio-tungstenite and ported to the traits of the futures crate. Integration into async-std, tokio and gio was added on top of that.

Dependencies

~4–9.5MB
~212K SLoC