{"id":26847783,"url":"https://github.com/nerixyz/twitch-pubsub-rs","last_synced_at":"2025-03-30T20:30:59.890Z","repository":{"id":45099453,"uuid":"389738704","full_name":"Nerixyz/twitch-pubsub-rs","owner":"Nerixyz","description":"Connect to Twitch PubSub from Rust land.","archived":false,"fork":false,"pushed_at":"2024-04-08T10:00:52.000Z","size":128,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-08T11:24:40.195Z","etag":null,"topics":["hacktoberfest","pubsub","rust","twitch"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nerixyz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-07-26T18:56:08.000Z","updated_at":"2024-04-08T11:24:40.618Z","dependencies_parsed_at":"2024-04-01T09:33:42.980Z","dependency_job_id":"8c066290-37aa-49ec-af44-f0756cafaa7e","html_url":"https://github.com/Nerixyz/twitch-pubsub-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nerixyz%2Ftwitch-pubsub-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nerixyz%2Ftwitch-pubsub-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nerixyz%2Ftwitch-pubsub-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nerixyz%2Ftwitch-pubsub-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nerixyz","download_url":"https://codeload.github.com/Nerixyz/twitch-pubsub-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246378955,"owners_count":20767686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","pubsub","rust","twitch"],"created_at":"2025-03-30T20:30:59.130Z","updated_at":"2025-03-30T20:30:59.884Z","avatar_url":"https://github.com/Nerixyz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# twitch-pubsub\n\nConnect to Twitch [PubSub](https://dev.twitch.tv/docs/pubsub) from Rust land.\n\nThis crate is basically randers' [`twitch-irc-rs`](https://lib.rs/crates/twitch-irc)\nbut for [PubSub](https://dev.twitch.tv/docs/pubsub).\n\nFor the provided types,\nthis crate is using the types provided by [`twitch_api2`](https://lib.rs/crates/twitch_api2) from Emilgardis.\n\n# Documentation\n\n~~Documentation can be found at [docs.rs](https://docs.rs/twitch-pubsub).~~\nNot yet.\n\n# Features\n\n- Automatic reconnection\n- Connection pooling\n- Custom token handling\n\n# Example\n\n```rust\nuse twitch_pubsub::{\n    PubsubClient,\n    Topic,\n    moderation,\n    providers::StaticTokenProvider,\n    ClientConfig,\n    ServerMessage,\n    TopicData,\n};\n\n#[tokio::main]\npub async fn main() {\n    let config = ClientConfig::new(StaticTokenProvider::new(\"MY STATIC SECRET TOKEN\"));\n    let (mut incoming, client) = PubsubClient::new(config);\n\n    client.listen(Topic::ChatModeratorActions(moderation::ChatModeratorActions {\n        // your user-id\n        user_id: 129546453,\n        channel_id: 129546453\n    })).await.expect(\"Failed listening to chat-moderator-actions\");\n\n    while let Some(message) = incoming.recv().await {\n        match message {\n            ServerMessage::Data(\n                TopicData::ChatModeratorActions { topic, reply }\n            )=\u003e {\n                println!(\"Message on {:?}: {:?}\", topic, reply);\n            },\n            // handle other messages here\n            _ =\u003e ()\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerixyz%2Ftwitch-pubsub-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerixyz%2Ftwitch-pubsub-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerixyz%2Ftwitch-pubsub-rs/lists"}