[][src]Function twitchchat::connect

pub async fn connect<'_>(
    user_config: &'_ UserConfig,
    secure: impl Into<Option<Secure>>
) -> Result<(BoxAsyncRead, BoxAsyncWrite)>

Opens an async TCP connection using the provided UserConfig and Secure setting

If secure is None, it'll use the normal TCP socket

Panics

This panics if you try to use a secure connection but have the tls feature disabled

Example

With TLS

let user_config = UserConfig::builder().anonymous().build().unwrap();
let secure = Secure::Nope; // or None
let (read, write) = connect(&user_config, secure).await.unwrap();

Without TLS

let user_config = UserConfig::builder().anonymous().build().unwrap();
let secure = Secure::Nope; // or None
let (read, write) = connect(&user_config, secure).await.unwrap();