Skip to content

Add EventSub functionality and deprecate legacy IRC transport#86

Open
denpadokei wants to merge 1 commit intoErisApps:mainfrom
denpadokei:event-sub
Open

Add EventSub functionality and deprecate legacy IRC transport#86
denpadokei wants to merge 1 commit intoErisApps:mainfrom
denpadokei:event-sub

Conversation

@denpadokei
Copy link
Copy Markdown

This pull request introduces major improvements to Twitch EventSub support, including the addition of new models for EventSub payloads and events, updates to JSON serialization contexts, and enhancements to dependency injection and package versions. The changes enable more comprehensive handling of Twitch chat events, notifications, and settings, and improve serialization performance and compatibility.

EventSub Models and Payloads:

  • Added new models for Twitch EventSub payloads and events, including EventSubChatMessagePayload, EventSubChatNotificationPayload, EventSubChatMessageDeletePayload, EventSubChatClearPayload, EventSubChatSettingsPayload, and EventSubSessionPayload. These models cover chat messages, notifications, message deletions, chat clears, chat settings, and session information. [1] [2] [3] [4] [5] [6]
  • Introduced a generic EventSubWebSocketMessage<TPayload> structure and supporting metadata for handling incoming WebSocket messages from Twitch.

JSON Serialization Enhancements:

  • Added a new TwitchEventSubSerializerContext to register all EventSub-related types for source-generated JSON serialization, improving performance and reliability.
  • Updated TwitchHelixSerializerContext to include additional EventSub-related request and response DTOs for serialization.

Dependency Injection and Service Registration:

  • Refactored Twitch service registrations in the DI container to use RegisterMany for ITwitchHelixApiService and ITwitchPubSubServiceManager, and added an initializer for ITwitchAuthService. This improves service resolution and initialization.

API DTOs and Polyfills:

  • Added new request DTOs for sending chat messages and managing EventSub subscriptions (SendChatMessageRequestDto, EventSubSubscriptionRequestDto, EventSubTransportDto).
  • Added a polyfill for IsExternalInit to support init accessors in .NET Standard 2.0+.

Package Updates:

  • Upgraded the System.Text.Json package from version 7.0.2 to 10.0.5 for improved serialization features and performance.

These changes lay the groundwork for robust support of Twitch's EventSub system and modernize the serialization and dependency injection infrastructure.

…transport

- Implement SendChatMessage method to send messages to a broadcaster's chat.
- Add CreateEventSubSubscription method for creating EventSub subscriptions.
- Implement DeleteEventSubSubscription method to remove EventSub subscriptions.
- Update retry policy in TwitchHelixApiService for better exponential backoff.
- Mark TwitchIrcService and legacy PubSub service as obsolete, recommending migration to EventSub.
@ErisApps
Copy link
Copy Markdown
Owner

ErisApps commented Apr 7, 2026

Hii @denpadokei,

First of all thank you for the pull request.
I'm still pretty pre-occupied throughout the week, but I'll try getting to reviewing this over the weekend. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants