1
0
mirror of https://github.com/actix/examples synced 2024-11-30 17:14:35 +01:00

fix description of send_to_broadcast_ws handler

This commit is contained in:
Rob Ede 2023-08-30 15:40:53 +01:00
parent 8de8672d6e
commit a998ce8ed8
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -38,8 +38,8 @@ async fn echo_ws(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse,
Ok(res) Ok(res)
} }
/// Handshake and start broadcast WebSocket handler with heartbeats. /// Send message to clients connected to broadcast WebSocket.
async fn send( async fn send_to_broadcast_ws(
body: web::Bytes, body: web::Bytes,
tx: web::Data<broadcast::Sender<web::Bytes>>, tx: web::Data<broadcast::Sender<web::Bytes>>,
) -> Result<impl Responder, Error> { ) -> Result<impl Responder, Error> {
@ -81,7 +81,7 @@ async fn main() -> std::io::Result<()> {
.service(web::resource("/ws-basic").route(web::get().to(echo_ws))) .service(web::resource("/ws-basic").route(web::get().to(echo_ws)))
.app_data(web::Data::new(tx.clone())) .app_data(web::Data::new(tx.clone()))
.service(web::resource("/ws-broadcast").route(web::get().to(broadcast_ws))) .service(web::resource("/ws-broadcast").route(web::get().to(broadcast_ws)))
.service(web::resource("/send").route(web::post().to(send))) .service(web::resource("/send").route(web::post().to(send_to_broadcast_ws)))
// enable logger // enable logger
.wrap(middleware::Logger::default()) .wrap(middleware::Logger::default())
}) })