diff --git a/actix-ws/README.md b/actix-ws/README.md
index b3744c110..d035b68e4 100644
--- a/actix-ws/README.md
+++ b/actix-ws/README.md
@@ -1,4 +1,4 @@
-# Actix WS (Next Gen)
+# `actix-ws`
> WebSockets for Actix Web, without actors.
@@ -6,18 +6,16 @@
[![crates.io](https://img.shields.io/crates/v/actix-ws?label=latest)](https://crates.io/crates/actix-ws)
[![Documentation](https://docs.rs/actix-ws/badge.svg?version=0.2.0)](https://docs.rs/actix-ws/0.2.0)
-![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-ws)
+![Version](https://img.shields.io/badge/rustc-1.75+-ab6000.svg)
+![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-ws.svg)
+
[![Dependency Status](https://deps.rs/crate/actix-ws/0.2.0/status.svg)](https://deps.rs/crate/actix-ws/0.2.0)
+[![Download](https://img.shields.io/crates/d/actix-ws.svg)](https://crates.io/crates/actix-ws)
+[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
-## Documentation & Resources
-
-- [API Documentation](https://docs.rs/actix-ws)
-- [Example Chat Project](https://github.com/actix/examples/tree/master/websockets/chat-actorless)
-- Minimum Supported Rust Version (MSRV): 1.75
-
-## Usage
+## Example
```rust
use actix_web::{middleware::Logger, web, App, HttpRequest, HttpServer, Responder};
@@ -60,6 +58,12 @@ async fn main() -> std::io::Result<()> {
}
```
+## Resources
+
+- [API Documentation](https://docs.rs/actix-ws)
+- [Example Chat Project](https://github.com/actix/examples/tree/master/websockets/chat-actorless)
+- Minimum Supported Rust Version (MSRV): 1.75
+
## License
This project is licensed under either of
diff --git a/actix-ws/src/lib.rs b/actix-ws/src/lib.rs
index 8a72c6d4e..b3fd6a62b 100644
--- a/actix-ws/src/lib.rs
+++ b/actix-ws/src/lib.rs
@@ -16,18 +16,19 @@ use actix_web::{web, HttpRequest, HttpResponse};
use tokio::sync::mpsc::channel;
mod aggregated;
-mod fut;
mod session;
+mod stream;
pub use self::{
aggregated::{AggregatedMessage, AggregatedMessageStream},
- fut::{MessageStream, StreamingBody},
session::{Closed, Session},
+ stream::{MessageStream, StreamingBody},
};
/// Begin handling websocket traffic
///
/// ```no_run
+/// use std::io;
/// use actix_web::{middleware::Logger, web, App, HttpRequest, HttpServer, Responder};
/// use actix_ws::Message;
/// use futures_util::StreamExt as _;
@@ -43,6 +44,7 @@ pub use self::{
/// return;
/// }
/// }
+///
/// Message::Text(msg) => println!("Got text: {msg}"),
/// _ => break,
/// }
@@ -55,17 +57,15 @@ pub use self::{
/// }
///
/// #[tokio::main(flavor = "current_thread")]
-/// async fn main() -> std::io::Result<()> {
+/// async fn main() -> io::Result<()> {
/// HttpServer::new(move || {
/// App::new()
-/// .wrap(Logger::default())
/// .route("/ws", web::get().to(ws))
+/// .wrap(Logger::default())
/// })
-/// .bind("127.0.0.1:8080")?
+/// .bind(("127.0.0.1", 8080))?
/// .run()
-/// .await?;
-///
-/// Ok(())
+/// .await
/// }
/// ```
pub fn handle(
diff --git a/actix-ws/src/fut.rs b/actix-ws/src/stream.rs
similarity index 98%
rename from actix-ws/src/fut.rs
rename to actix-ws/src/stream.rs
index 3dd178a43..e95c17f43 100644
--- a/actix-ws/src/fut.rs
+++ b/actix-ws/src/stream.rs
@@ -21,10 +21,9 @@ use tokio::sync::mpsc::Receiver;
use crate::AggregatedMessageStream;
-/// A response body for Websocket HTTP Requests
+/// Response body for a WebSocket.
pub struct StreamingBody {
session_rx: Receiver,
-
messages: VecDeque,
buf: BytesMut,
codec: Codec,
@@ -43,7 +42,7 @@ impl StreamingBody {
}
}
-/// Stream of Messages from a websocket client.
+/// Stream of messages from a WebSocket client.
pub struct MessageStream {
payload: Payload,
diff --git a/justfile b/justfile
index 85905cdac..7984cb4f0 100644
--- a/justfile
+++ b/justfile
@@ -29,8 +29,8 @@ fmt: update-readmes
[group("lint")]
update-readmes:
cd ./actix-cors && cargo rdme --force
- cd ./actix-session && cargo rdme --force
cd ./actix-identity && cargo rdme --force
+ cd ./actix-session && cargo rdme --force
fd README.md --exec-batch npx -y prettier --write
# Test workspace code.