[−][src]Function twitchchat::connect_easy
pub async fn connect_easy<'_, '_>(
name: &'_ str,
token: &'_ str,
secure: impl Into<Option<Secure>>
) -> Result<(BoxAsyncRead, BoxAsyncWrite)>
Opens an async TCP connection using the provided name
, token
and Secure
setting
If secure
is None
, it'll use the normal TCP socket
This enables all of the Capabilities
Panics
This panics if you try to use a secure connection but have the tls
feature disabled
Example
With TLS
let (nick, pass) = ANONYMOUS_LOGIN; let secure = Secure::UseTls; let (read, write) = connect_easy(nick, pass, secure).await.unwrap();
Without TLS
let (nick, pass) = ANONYMOUS_LOGIN; let secure = Secure::Nope; // or None let (read, write) = connect_easy(nick, pass, secure).await.unwrap();