diff --git a/Cargo.toml b/Cargo.toml index bccb0b77..f32b9ef8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,3 +80,7 @@ rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] features = ["ws"] + +[[example]] +name = "chat" +required-features = ["ws"] \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 8bf8ecde..b38e19e4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -15,3 +15,4 @@ - [`unix_domain_socket`](../examples/unix_domain_socket.rs) - How to run an Axum server over unix domain sockets. - [`sessions`](../examples/sessions.rs) - Sessions and cookies using [`async-session`](https://crates.io/crates/async-session). - [`tls_rustls`](../examples/tls_rustls.rs) - TLS with [`tokio-rustls`](https://crates.io/crates/tokio-rustls). +- [`chat`](../examples/chat.rs) - Chat application example. diff --git a/examples/chat.rs b/examples/chat.rs index 732dade5..d1358bc5 100644 --- a/examples/chat.rs +++ b/examples/chat.rs @@ -1,3 +1,11 @@ +//! Example chat application. +//! +//! Run with +//! +//! ``` +//! cargo run --features=ws --example chat +//! ``` + use std::collections::HashSet; use std::net::SocketAddr; use std::sync::{Arc, Mutex};