Skip to content

migrate to eventsub #58

Open
Open

Description

@zephyrtronium

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.

Activity

  1. added this to the Rewrite milestone on Aug 23, 2024
  2. zephyrtronium commented on Aug 24, 2024

    @zephyrtronium
    OwnerAuthor

    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.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions