pub fn add_extensions<I>(mut self, extensions: I) -> Self
	where
		I: IntoIterator<Item = Extension>,
	{
		let extensions = WebSocketExtensions(extensions.into_iter().collect());
		self.headers.insert(SEC_WEBSOCKET_EXTENSIONS, extensions.into());
		self
	}
/// Adds some extensions to the connection.
/// Currently no extensions are supported out-of-the-box but one can
/// still use them by using their own implementation. Support is coming soon though.
///
/// ```rust
/// # extern crate http;
/// # extern crate websocket;
/// # use http::header::SEC_WEBSOCKET_EXTENSIONS;
/// # use websocket::ClientBuilder;
/// # use websocket::header::sec_websocket_extensions::{Extension, WebSocketExtensions};
/// fn main() {
/// let builder = ClientBuilder::new("wss://moxie-chat.org").unwrap()
///     .add_extensions(vec![
///         Extension {
///             name: "permessage-deflate".to_string(),
///             params: vec![],
///         },
///         Extension {
///             name: "crypt-omemo".to_string(),
///             params: vec![],
///         },
///     ]);
///
/// # let exts = &builder.get_header(SEC_WEBSOCKET_EXTENSIONS).unwrap()
/// #     .to_str().unwrap().parse::<WebSocketExtensions>().unwrap();
/// # assert!(exts.first().unwrap().name == "permessage-deflate");
/// # assert!(exts.last().unwrap().name == "crypt-omemo");
/// }
/// ```
Adds some extensions to the connection.
Currently no extensions are supported out-of-the-box but one can
still use them by using their own implementation. Support is coming soon though.


Adds some extensions to the connection . Currently no extensions are supported out - of - the - box but one can still use them by using their own implementation . Support is coming soon though .
pub fn add_extensions<I>(mut self, extensions: I) -> Self
	where
		I: IntoIterator<Item = Extension>,
	{
		let extensions = WebSocketExtensions(extensions.into_iter().collect());
		self.headers.insert(SEC_WEBSOCKET_EXTENSIONS, extensions.into());
		self
	}
pub fn add_extensions < I > ( mut self , extensions : I ) -> Self where I : IntoIterator < Item = Extension > , { let extensions = WebSocketExtensions ( extensions . into_iter ( ) . collect ( ) ) ; self . headers . insert ( SEC_WEBSOCKET_EXTENSIONS , extensions . into ( ) ) ; self }
Adds some extensions to the connection.
Adds some extensions to the connection .
mut self
extensions
I
mut self
extensions
I
extern crate http;
None
extern crate websocket;
None
use http::header::sec_websocket_extensions;
None
use websocket::clientbuilder;
None
use websocket::header::sec_websocket_extensions::{extension, websocketextensions};
fn main() {
let builder = ClientBuilder::new("wss://moxie-chat.org").unwrap()
.add_extensions(vec![
Extension {
name: "permessage-deflate".to_string(),
params: vec![],
},
Extension {
name: "crypt-omemo".to_string(),
params: vec![],
},
]).
fn main () { let builder = ClientBuilder :: new ( " wss : // moxie - chat . org " ) . unwrap () . add_extensions ( vec! [ Extension { name : " permessage - deflate " . to_string () params : vec! [] } Extension { name : " crypt - omemo " . to_string () params : vec! [] } ] ) .
let exts = &builder.get_header(sec_websocket_extensions).unwrap()
None
.to_str().unwrap().parse::<websocketextensions>().unwrap();
None
assert!(exts.first().unwrap().name == "permessage-deflate");
None
assert!(exts.last().unwrap().name == "crypt-omemo");
None