wscall
WSCALL is a lightweight WebSocket API framework with a custom binary frame protocol, a reusable Rust server crate, a reusable Rust client crate, and a facade crate for consumers that prefer a single dependency.
Workspace Layout
The repository is now organized as a Cargo workspace:
crates/
wscall-protocol/
wscall-server/
wscall-client/
wscall/
Each crate has a clear responsibility:
wscall-protocol: shared frame codec, envelope types, file attachment model, and protocol errors.wscall-server: reusable WebSocket server framework with routes, filters, validation, exception mapping, and server push events.wscall-client: reusable client SDK with request correlation, event ACK correlation, and server event subscriptions.wscall: facade crate that re-exports protocol plus optional server and client APIs behind features.
Protocol Summary
Each WebSocket binary message is encoded as:
| frame_len:u32 | message_type:u8 | encryption:u8 | payload |
Transport behavior:
- Plaintext mode stores JSON directly in
payload. ChaCha20andAES256modes store12-byte nonce + ciphertextinpayload.- The payload limit is
10 * 1024 * 1024 - 6, which keeps the full WSCALL frame within10 MiB. - File parameters use JSON references plus inline Base64 attachments.
Use As Crates
Depend on only what you need:
[]
= "0.1"
= "0.1"
Or use the facade crate:
[]
= { = "0.1", = ["full"] }
Quick Start
Minimal server:
use json;
use WscallServer;
async
Minimal client:
use json;
use WscallClient;
async
Runnable end-to-end quick start:
Run The Demos
Start the demo server:
In another terminal, run the demo client:
The demos exercise:
system.echoAPI.files.inspectAPI with inline attachment.chat.messageevent emit and broadcast.chat.historyAPI query.- End-to-end ChaCha20 frame encryption using the demo key wired in both examples.
Quality Gates
Recommended checks before publishing or merging:
Publishing Checklist
Before publishing the crates to crates.io:
- Confirm the configured
repositoryandhomepagemetadata still match the canonical repository. - Run the quality gates locally.
- Run
cargo packageforwscall-protocolto validate the root dependency crate. - Publish in dependency order:
wscall-protocol,wscall-server,wscall-client, thenwscall. - After each publish, wait for the crates.io index to catch up before packaging or publishing the next dependent crate.
For the first release of this crate family, dependent crates such as wscall-server and wscall-client cannot complete a full standalone cargo package verification until wscall-protocol is already available on crates.io.
See RELEASE.md for a release sequence that matches this dependency chain.
Version history is tracked in CHANGELOG.md.
Current Constraints
ChaCha20andAES256-GCMare implemented inFrameCodec; the demos still default toChaCha20.- Attachments are inline Base64 and suited to small files.
- Large-file chunking is not part of the current core protocol.
- The published crate and code identifiers have been renamed to
wscall.