The easiest way to connect your game/project to Twitch!
Use Follows, Subscriptions, Chat messages and whispers in your game. No server, backend or additional packages needed!StreamValet is a simple and lightweight asset for Unity that integrates Twitch EventSub directly via WebSockets.It receives real-time Twitch events using Twitch eventsub. The tokens are obtained via the OAuth Device Flow (The player\streamer would need to authorize via a browser when first playing) and will persist authentication data between runs.Supported events:* Incoming Channel chat messages* Incoming Whispers* Follows* SubscriptionsFEATURES* OAuth Device Flow authentication* Persistent access token (stored using PlayerPrefs)* EventSub WebSocket connection* Automatic WebSocket reconnect (handles Twitch session_reconnect and network interruptions)* Chat messages via EventSub* Incoming Whisper support* New Follow notifications* New Subscription notifications* Customizable authentication entry pointSETUP1. Import the asset into your project. It should include 2 scripts and a ReadMe text file. An example scene is also provided, but not required.2. Add ConnectionTW.cs and EventsTW.cs to a new GameObject or an existing one like a game manager.3. In the Inspector, select the GameObject from step 2 and enter your public Twitch Client ID in the clientId field. This can be obtained from your Twitch Developer Console.4. Call the StartTwitchConnection() method in EventsTW.cs to start the connection. By default, this happens on Start, but can be modified to be called on a button click or any other time.REQUIRED OAUTH SCOPESTo use all supported features, the streamer is requested to authorize the following scopes:user:read:chatuser:read:whispersmoderator:read:followerschannel:read:subscriptionsThe authenticated Twitch account must be the broadcaster for all channel events (chat, follows, subscriptions) to function.PLATFORM SUPPORTSupported:Windows (Standalone)macOS (Standalone)Linux (Standalone)WebGL:WebSocket and OAuth browser behavior may not function correctly in WebGL builds due to browser security restrictions. WebGL is not officially supported.Mobile:Not officially tested. Behavior may vary depending on platform browser handling and WebSocket support.LIMITATIONS* Designed for a single broadcaster per instance.* Does not use IRC chat, as it doesn’t support whispers or channel events.* Requires a public client ID from the Twitch developer console.* Requires an active internet connection.* Uses Twitch public APIs but is not affiliated with Twitch.RECOMMENDED USAGE* Place ConnectionTW.cs and EventsTW.cs on a central manager GameObject.* Handle events inside EventsTW.cs.* Do not modify ConnectionTW.cs unless extending core behavior.* Each connection creates fresh EventSub subscriptions. Avoid manually duplicating subscriptions outside the provided system.




