#websocket

websocket-lite

A fast, low-overhead WebSocket client

13 releases

✓ Uses Rust 2018 edition

0.3.3 Mar 1, 2020
0.3.2 Dec 2, 2019
0.3.2-alpha.6 Nov 22, 2019
0.3.0-alpha.6 Oct 26, 2019
0.1.2 Oct 24, 2018

#11 in WebSocket

Download history 35/week @ 2019-12-02 34/week @ 2019-12-09 5/week @ 2019-12-16 16/week @ 2019-12-23 38/week @ 2019-12-30 19/week @ 2020-01-06 31/week @ 2020-01-13 16/week @ 2020-01-20 1/week @ 2020-01-27 4/week @ 2020-02-03 14/week @ 2020-02-10 17/week @ 2020-02-17 102/week @ 2020-02-24 16/week @ 2020-03-02 31/week @ 2020-03-09 19/week @ 2020-03-16

107 downloads per month
Used in 3 crates (via cxmr-ws-client)

MIT license

50KB
1K SLoC

Razor 706 SLoC // 0.1% comments Rust 409 SLoC // 0.1% comments

websocket-lite

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

websocket-lite

Documentation

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.

websocket-codec

Documentation

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

hyper-websocket-lite

Documentation

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

async/await

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.

Dependencies

~5MB
~112K SLoC