Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to eventsub #58

Open
zephyrtronium opened this issue Aug 23, 2024 · 1 comment
Open

migrate to eventsub #58

zephyrtronium opened this issue Aug 23, 2024 · 1 comment
Assignees
Milestone

Comments

@zephyrtronium
Copy link
Owner

Rather than #50, we should use EventSub to subscribe to streamer online and offline notifications directly. Later we can also use chat over EventSub.

Using EventSub over WebSockets directly would be fine, but it is probably better to use a conduit with one shard for full instant reconnect. Not sure what the UX for creating the conduit should be, though. It seems fine to Get Conduits and use whatever we see or Create Conduit if we see nothing.

@zephyrtronium
Copy link
Owner Author

zephyrtronium commented Aug 24, 2024

It seems like chat over EventSub will also be easy. The rough outline of how we do auth for it (thanks to BarryCarlyon):

  • Get an app access token through client credentials grant flow. This is trivial, and we'll need it for other EventSub subscriptions anyway.
  • Get a user access token for the bot's user account through the device code flow or authorization code grant flow that we're already using. We need user:read:chat, user:write:chat, and newly user:bot scopes.
  • Have the broadcaster use implicit grant flow to connect to the Robot app, with the redirect being to a GitHub Pages or other static site on the public internet. This needs only channel:bot scope. Since we don't need to perform any moderator actions or similar, we can discard this user access token; just having the account connection is sufficient.
  • Use the app access token to Send Chat Message through the API. Note this will continue to work after the channel:bot token expires.

That means overall we will need to subscribe to:

  • channel.chat.clear
  • channel.chat.clear_user_messages
  • channel.chat.message
  • channel.chat.message_delete
  • channel.chat.notification, if we do thank sub gifters #18
  • conduit.shard.disabled maybe?
  • stream.online
  • stream.offline
  • user.whisper.message maybe, requires user:manage:whispers scope in the bot's user access token

Given the limit of 300 subscriptions per WebSocket EventSub connection, that means 33-50 broadcasters per shard. Plenty for now; if we need to support more than that, we'll probably want to switch to webhooks anyway.

zephyrtronium added a commit that referenced this issue Aug 26, 2024
zephyrtronium added a commit that referenced this issue Aug 29, 2024
@zephyrtronium zephyrtronium self-assigned this Aug 30, 2024
zephyrtronium added a commit that referenced this issue Aug 30, 2024
zephyrtronium added a commit that referenced this issue Aug 30, 2024
zephyrtronium added a commit that referenced this issue Sep 2, 2024
zephyrtronium added a commit that referenced this issue Sep 2, 2024
As yet untested, but I need my daily metrics.

For #58.
zephyrtronium added a commit that referenced this issue Sep 6, 2024
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

No branches or pull requests

1 participant