1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

s/websocket/WebSocket in docs

This commit is contained in:
Rob Ede
2021-02-12 00:27:20 +00:00
parent 81bef93e5e
commit 4fc7d76759
10 changed files with 28 additions and 29 deletions

View File

@ -45,7 +45,7 @@ use crate::http::{ConnectionType, Error as HttpError, Method, StatusCode, Uri, V
use crate::response::ClientResponse;
use crate::ClientConfig;
/// `WebSocket` connection
/// WebSocket connection.
pub struct WebsocketsRequest {
pub(crate) head: RequestHead,
err: Option<HttpError>,
@ -59,7 +59,7 @@ pub struct WebsocketsRequest {
}
impl WebsocketsRequest {
/// Create new websocket connection
/// Create new WebSocket connection
pub(crate) fn new<U>(uri: U, config: Rc<ClientConfig>) -> Self
where
Uri: TryFrom<U>,
@ -102,7 +102,7 @@ impl WebsocketsRequest {
self
}
/// Set supported websocket protocols
/// Set supported WebSocket protocols
pub fn protocols<U, V>(mut self, protos: U) -> Self
where
U: IntoIterator<Item = V>,
@ -239,7 +239,7 @@ impl WebsocketsRequest {
self.header(AUTHORIZATION, format!("Bearer {}", token))
}
/// Complete request construction and connect to a websockets server.
/// Complete request construction and connect to a WebSocket server.
pub async fn connect(
mut self,
) -> Result<(ClientResponse, Framed<BoxedSocket, Codec>), WsClientError> {
@ -338,7 +338,7 @@ impl WebsocketsRequest {
return Err(WsClientError::InvalidResponseStatus(head.status));
}
// Check for "UPGRADE" to websocket header
// check for "UPGRADE" to WebSocket header
let has_hdr = if let Some(hdr) = head.headers.get(&header::UPGRADE) {
if let Ok(s) = hdr.to_str() {
s.to_ascii_lowercase().contains("websocket")

View File

@ -31,7 +31,7 @@ async fn test_simple() {
.send(h1::Message::Item((res.drop_body(), BodySize::None)))
.await?;
// start websocket service
// start WebSocket service
let framed = framed.replace_codec(ws::Codec::new());
ws::Dispatcher::with(framed, ws_service).await
}