|
|
|
@ -18,7 +18,7 @@ use std::io::{Read, Write}; |
|
|
|
|
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
|
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
|
pub fn accept_with_config<S: Read + Write + Unpin>( |
|
|
|
|
pub fn accept_with_config<S: Read + Write>( |
|
|
|
|
stream: S, |
|
|
|
|
config: Option<WebSocketConfig>, |
|
|
|
|
) -> 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`
|
|
|
|
|
/// for the stream here. Any `Read + Write` streams are supported, including
|
|
|
|
|
/// those from `Mio` and others.
|
|
|
|
|
pub fn accept<S: Read + Write + Unpin>( |
|
|
|
|
pub fn accept<S: Read + Write>( |
|
|
|
|
stream: S, |
|
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { |
|
|
|
|
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
|
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
|
/// 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, |
|
|
|
|
callback: C, |
|
|
|
|
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
|
|
|
|
|
/// for header processing. The callback receives headers of the incoming
|
|
|
|
|
/// 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, |
|
|
|
|
callback: C, |
|
|
|
|
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, C>>> { |
|
|
|
|