Pure Rust implementation of Gun. For a wasm version, check out gun-rs-wasm.
Deployed at https://gun-us.herokuapp.com (serves iris-messenger at the root)
Live stats: https://gun-us.herokuapp.com/stats
Install Rust first.
cargo install gundb
gundb start
rust
use gundb::{Node, NodeConfig};
use gundb::types::GunValue;
let mut db = Node::new_with_config(NodeConfig {
outgoing_websocket_peers: vec!["wss://some-server-to-sync.with/gun".to_string()],
..NodeConfig::default()
});
let sub = db.get("greeting").on();
db.get("greeting").put("Hello World!".into());
if let Ok(value) = sub.recv().await {
if let GunValue::Text(str) = value {
assert_eq!(&str, "Hello World!");
}
}
3/12/2021:
cargo install cargo-watch
RUST_LOG=debug cargo watch -x 'run -- start'
heroku create --buildpack emk/rust
git push heroku master
or: