#websocket #codec


A Tokio codec for the websocket protocol

8 releases

✓ Uses Rust 2018 edition

new 0.2.3-alpha.6 Dec 1, 2019
0.2.2 Dec 2, 2019
0.2.2-alpha.6 Nov 22, 2019
0.2.0-alpha.6 Oct 26, 2019
0.1.1 Apr 15, 2019

#20 in WebSocket

Download history 6/week @ 2019-08-19 9/week @ 2019-08-26 11/week @ 2019-09-02 16/week @ 2019-09-09 29/week @ 2019-09-16 14/week @ 2019-09-23 9/week @ 2019-09-30 2/week @ 2019-10-07 5/week @ 2019-10-14 42/week @ 2019-10-21 16/week @ 2019-10-28 35/week @ 2019-11-04 5/week @ 2019-11-11 47/week @ 2019-11-18 39/week @ 2019-11-25

91 downloads per month
Used in 1 crate

MIT license

671 lines

websocket-lite and websocket-codec

Build Status

This repo contains two crates:

  • websocket-lite, a fast, low-overhead WebSocket client
  • websocket-codec, a Tokio codec implementation of the WebSocket protocol



This crate is optimised for receiving a high volume of messages over a long period. A key feature is that it makes no memory allocations once the connection is set up and the initial messages have been sent and received; it reuses a single pair of buffers, which are sized for the longest message seen so far.

You can use this crate in both asynchronous (futures-based) and synchronous code. native_tls provides the TLS functionality for wss://... servers.

This crate is fully conformant with the fuzzingserver module in the Autobahn test suite.



This is a standalone crate that does not do any I/O directly. For a full WebSocket client, see the websocket-lite crate.


As of October 2019, the master branch builds against Rust nightly, and is expected to build against Rust stable 1.40. It currently references futures-preview = "0.3.0-alpha.19" and tokio = "0.2.0-alpha.6".


~39K SLoC