An example of a peer-to-peer network implementing causal ordering using WebSockets.
- Install Rust for your system.
- Use Cargo to build the source:
cd ws-p2p/ cargo build
RUST_LOG=ws-p2p=info ./target/debug/ws-p2p \ --server 127.0.0.1:3012 \ # Address to run this peer with. --demo 127.0.0.1:3014 # Address of the peer you want to be delayed (for demo-purposes).
RUST_LOG=ws-p2p=info ./target/debug/ws-p2p \ --server 127.0.0.1:3013 \ ws://127.0.0.1:3012 # A list of peer's to connect with.
RUST_LOG=ws-p2p=info ./target/debug/ws-p2p \ --server 127.0.0.1:3014 \ ws://127.0.0.1:3012 \ # A list of peer's to connect with. ws://127.0.0.1:3014
- Dynamically adding peers hasn't been tested well, so expect it to fail instantly.
- Leaving for peers hasn't been implemented. Theoretically, it should be straight-forward with this implementation. Currently, I'm not receiving a closed or errored websocket connection message as expected to begin adding this feature, so I've left it as is for now.