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

async-tungstenite

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

10 releases (4 breaking)

✓ Uses Rust 2018 edition

0.5.0 May 22, 2020
0.4.2 Mar 25, 2020
0.4.0 Feb 1, 2020
0.3.1 Jan 6, 2020
0.1.1 Nov 29, 2019

#3 in WebSocket

Download history 277/week @ 2020-02-09 470/week @ 2020-02-16 430/week @ 2020-02-23 870/week @ 2020-03-01 1126/week @ 2020-03-08 795/week @ 2020-03-15 658/week @ 2020-03-22 1210/week @ 2020-03-29 1800/week @ 2020-04-05 1980/week @ 2020-04-12 1734/week @ 2020-04-19 4025/week @ 2020-04-26 1822/week @ 2020-05-03 2729/week @ 2020-05-10 2162/week @ 2020-05-17 2279/week @ 2020-05-24

6,955 downloads per month
Used in 13 crates (12 directly)

MIT license

63KB
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-tls: Enables the additional functions in the tokio module to implement TLS via tokio-tls.
  • 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–6.5MB
~133K SLoC