Expand description
§Twitch IRC Client
This is the main interface for interacting with Twitch IRC.
The entrypoint to this module is the Client
.
The simplest way to get started is using Client::anonymous
,
which will connect to Twitch IRC anonymously.
let client = tmi::Client::anonymous().await?;
If you wish to be able to send messages, you have to generate an oauth2 token, and provide it to the client:
let credentials = tmi::Credentials::new("your_username", "oauth:your_token");
let client = tmi::Client::builder().credentials(credentials).connect().await?;
and then use Client::builder
followed by ClientBuilder::credentials
.
Generating an oauth2 token is out of scope for this library. Head over to the official documentation to see how you can generate one. twitch_oauth2 may be used to automate most of it.
⚠ Note: Client
is a fairly low-level interface! It does not automatically handle:
- Rate limiting (both for JOINs and PRIVMSGs)
- Same message bypass
RECONNECT
commands- Rejoining channels
- Latency measurement
What it does provide is:
- Opening a TCP connection (with TLS) to Twitch.
- Performing the handshake (authentication, capability negotiation)
- Reconnect with backoff
- A polling interface for receiving messages
- Sending commands (PRIVMSG, JOIN, PONG, etc.)
Modules§
Structs§
- Reconnect backoff configuration.
- Twitch IRC client.
- Builder for a
Client
. - Client configuration.
- Credentials used to authenticate to Twitch IRC.
- An error which occurred while attempting to reconnect to Twitch IRC.
Enums§
- An error which occurred while attempting to connect to Twitch IRC.
Constants§
- The default timeout used when connecting to Twitch IRC.