Networked Services
Hydroflow provides a robust framework for developing networked services. The best way to get started is to use the Hydroflow template.
cargo generate gh:hydro-project/hydroflow template/hydroflow
cd
into the generated folder, ensure the correct nightly version of rust is installed, and test the generated project:
cd <my-project>
rustup update
cargo test
The template contains a chat server & client implementation using UDP. You can start multiple instances of the client and connect to the same server.
Things to Check
- README - Contains instructions on building the template and running the client and server examples.
- server.rs - Contains the chat server implementation. The inline rust documentation explains the networking-related hydroflow operators and their usage.
- client.rs - Contains the chat client implementation. The inline rust documentation explains the networking-related hydroflow operators and their usage.
Hydroflow also supports TCP for reliable, connection-oriented communication. Understanding the differences and use cases of these protocols can help you choose the right one for your networked service.
Additional Examples
The Hydroflow examples directory contains additional examples that deal with networking. For example, the Randomized Gossip Server example extends the chat example to work with a cluster of redundant servers that use gossip for sharing chat-related state between themselves.