Struct websockets::WebSocketBuilder [−][src]
pub struct WebSocketBuilder { /* fields omitted */ }
Expand description
A builder used to customize the WebSocket handshake.
Handshake headers as well as subprotocols can be added and removed.
Methods prefixed with tls_
allow for the customization of a secure
WebSocket connection.
let mut ws = WebSocket::builder() .add_subprotocol("wamp") .connect("wss://echo.websocket.org") .await?;
Implementations
Builds a WebSocket
using this builder, then connects to a URL
(and performs the WebSocket handshake).
After calling this method, no more methods should be called on this builder.
Adds a header to be sent in the WebSocket handshake.
Removes a header which would be sent in the WebSocket handshake.
Adds a subprotocol to the list of subprotocols to be sent in the
WebSocket handshake. The server may select a subprotocol from this list.
If it does, the selected subprotocol can be found using the
WebSocket::accepted_subprotocol()
method.
Removes a subprotocol from the list of subprotocols that would be sent in the WebSocket handshake.
Controls the use of certificate validation. Defaults to false.
pub fn tls_danger_accept_invalid_hostnames(
&mut self,
accept_invalid_hostnames: bool
) -> &mut Self
pub fn tls_danger_accept_invalid_hostnames(
&mut self,
accept_invalid_hostnames: bool
) -> &mut Self
Controls the use of hostname verification. Defaults to false.
Adds a certificate to the set of roots that the connector will trust. The connector will use the system’s trust root by default. This method can be used to add to that set when communicating with servers not trusted by the system. Defaults to an empty set.
Controls the use of built-in system certificates during certificate validation. Defaults to false – built-in system certs will be used.
Sets the identity to be used for client certificate authentication.
Sets the maximum supported TLS protocol version. A value of None enables support for the newest protocols supported by the implementation. Defaults to None.
Sets the minimum supported TLS protocol version. A value of None enables support for the oldest protocols supported by the implementation. Defaults to Some(Protocol::Tlsv10).
Controls the use of Server Name Indication (SNI). Defaults to true.