|
|
@ -18,7 +18,7 @@ use std::io::{Read, Write}; |
|
|
|
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
|
|
|
|
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
pub fn accept_with_config<S: Read + Write + Unpin>( |
|
|
|
pub fn accept_with_config<S: Read + Write>( |
|
|
|
stream: S, |
|
|
|
stream: S, |
|
|
|
config: Option<WebSocketConfig>, |
|
|
|
config: Option<WebSocketConfig>, |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { |
|
|
@ -31,7 +31,7 @@ pub fn accept_with_config<S: Read + Write + Unpin>( |
|
|
|
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
|
|
|
|
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
pub fn accept<S: Read + Write + Unpin>( |
|
|
|
pub fn accept<S: Read + Write>( |
|
|
|
stream: S, |
|
|
|
stream: S, |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { |
|
|
|
accept_with_config(stream, None) |
|
|
|
accept_with_config(stream, None) |
|
|
@ -45,7 +45,7 @@ pub fn accept<S: Read + Write + Unpin>( |
|
|
|
/// This function does the same as `accept()` but accepts an extra callback
|
|
|
|
/// This function does the same as `accept()` but accepts an extra callback
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
/// requests and is able to add extra headers to the reply.
|
|
|
|
/// requests and is able to add extra headers to the reply.
|
|
|
|
pub fn accept_hdr_with_config<S: Read + Write + Unpin, C: Callback>( |
|
|
|
pub fn accept_hdr_with_config<S: Read + Write, C: Callback>( |
|
|
|
stream: S, |
|
|
|
stream: S, |
|
|
|
callback: C, |
|
|
|
callback: C, |
|
|
|
config: Option<WebSocketConfig>, |
|
|
|
config: Option<WebSocketConfig>, |
|
|
@ -58,7 +58,7 @@ pub fn accept_hdr_with_config<S: Read + Write + Unpin, C: Callback>( |
|
|
|
/// This function does the same as `accept()` but accepts an extra callback
|
|
|
|
/// This function does the same as `accept()` but accepts an extra callback
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
/// requests and is able to add extra headers to the reply.
|
|
|
|
/// requests and is able to add extra headers to the reply.
|
|
|
|
pub fn accept_hdr<S: Read + Write + Unpin, C: Callback>( |
|
|
|
pub fn accept_hdr<S: Read + Write, C: Callback>( |
|
|
|
stream: S, |
|
|
|
stream: S, |
|
|
|
callback: C, |
|
|
|
callback: C, |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, C>>> { |
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, C>>> { |
|
|
|