A new way to communicate in my app (and yours).
- Use most efficient data formats.
- Use most efficient protocols.
- Use most scalable technologies.
- Browser front-end support (other front-end platforms will be considered later)
- Rust Back-end (and binding to other languages later if needed)
- HTTP-like communication using
Request-Replymechanism of NATS - Bi-directional communication using
Pub-Submechanism of NATS - Websocket (and NATS protocol for the server) with ease of scaling (by using NATS Cluster and Super Cluster)
- Client-side load-balancing, Geo-Routing
- Type-safe, compact, fast and easy Serialization/Deserialization with the combination of
bitcode-rsandwasm-bindgen
- nats-server installed
- Start a local NATS server:
nats-server -c nats.conf - Rust installed
- wasm-pack installed
- Generate the WASM npm package by running
wasm-pack build - Publish built npm package to npm with
wasm-pack publish - In case you don't want to publish, you can pack the built npm package with
wasm-pack packand publish it anywhere else (like a private registry). - See an example project in
example_web, run it and open 2 browser tabs to see the communication in action.
- Build the Rust server by running
cargo build --release - The binary file will be located in
target/release/ - Or use
cargo runfor development
- Test npm package on browser with
wasm-pack test --chrome - Test Rust server with
cargo test(there's no test for the server yet)
- Add
bitcode,wasm-bindgen,async-natsas dependencies - Define TestData struct
- Derive TestData struct with traits:
bitcode::Decode,bitcode::Encodeandwasm-bindgen - Implement TestData struct with
#[wasm_bindgen] - Write tests in
tests/web_tests.rs
- bitcode-rs: For serialization/deserialization
- wasm-bindgen: For binding in the browser
- NATS.io: For messaging and communication between services.
- flate2: For compression and decompression