#websocket #codec #protocol


A Tokio codec for the websocket protocol

10 releases

✓ Uses Rust 2018 edition

0.3.4 Apr 30, 2020
0.3.3 Mar 1, 2020
0.2.3-alpha.6 Dec 1, 2019
0.2.2-alpha.6 Nov 22, 2019
0.1.1 Apr 15, 2019

#16 in WebSocket

Download history 4/week @ 2020-02-05 10/week @ 2020-02-12 23/week @ 2020-02-19 75/week @ 2020-02-26 26/week @ 2020-03-04 15/week @ 2020-03-11 41/week @ 2020-03-18 48/week @ 2020-03-25 42/week @ 2020-04-01 66/week @ 2020-04-08 48/week @ 2020-04-15 17/week @ 2020-04-22 37/week @ 2020-04-29 38/week @ 2020-05-06 73/week @ 2020-05-13 49/week @ 2020-05-20

140 downloads per month
Used in 6 crates (3 directly)

MIT license

705 lines


Build Status

This repo contains three crates:

  • websocket-lite, a fast, low-overhead WebSocket client
  • websocket-codec, a Tokio codec implementation of the WebSocket protocol
  • hyper-websocket-lite, bindings between a hyper server and websocket-codec



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.



Provides the server_upgrade function, which bridges a client's HTTP Upgrade request to the WebSocket protocol.


Version 0.3.2 and above use std futures and the async and await keywords. They are based on tokio 0.2 and futures 0.3 and the earliest supported compiler is 1.39.

Version 0.2.4 is the release prior to async/await. It is based on tokio 0.1 and futures 0.1.


~44K SLoC