wslay-sys
Low-level Rust FFI bindings to wslay, Tatsuhiro Tsujikawa's WebSocket C library.
The wslay C sources are vendored in this crate and compiled at build time with cc; the bindings are generated with bindgen. No system wslay installation is required.
This crate exposes wslay's event-based API verbatim — it is unsafe FFI only. For a safe, async wrapper (and a full-duplex WebSocket⇄byte-stream bridge with true sub-frame streaming), see ws-tcp.
Why wslay
wslay's event API, with wslay_event_config_set_no_buffering, delivers frame payloads incrementally via on_frame_recv_chunk_callback — it never buffers a whole frame, no matter how large. It performs no I/O itself (callback-driven), so it drops cleanly into async runtimes.
Build requirements
- A C compiler (
ccfinds one automatically). libclang(required bybindgen). On macOS it ships with the Command Line Tools; on Debian/Ubuntu installlibclang-dev.
License
This crate is MIT-licensed. The vendored wslay sources are also MIT-licensed — see vendor/COPYING.
Part of h2ts.