EventSub websocket requiring a user access token

I find it unreasonable for websockets only accept user access tokens because they seem way more simplistic than setting up a webhook. I am trying to make a discord bot that implements twitch event subs. if someone could explain to me why websockets only accept user access tokens or a simpler way of using eventsub that would be great.

Websockets are expected to be used in the front end.
If you are “web accessiable” webhooks are expected to be used

The choice of token infers the design/use case of the technology.

There are a number of limits on websockets as well.
Where as with webhooks you can have an inifinity amount of webhooks.

If you need a code example see GitHub - BarryCarlyon/twitch_discord_barrycarlyon_co_uk: A Super Simple Twitch to Discord Notification Tool

Which connects Twitch EventSub → Discord Webhooks.

What is the issue you are facing:

Webhooks

  1. Probably: authentication the user
  2. Create a thing to recieve data
  3. Make a HTTP Post request to request data
  4. Thing replies to the verification/callback HTTP POST
  5. Thing starts reciving data

Your thing crashes, you fix it, your subscriptions may still exist and after restart you get the missing data due to retries

This requires SSL which is free and generally easy to setup especailly if using a “quick starter hosting provider”

Websockets

  1. Have to authenticate a user
  2. Create a thing to recieve data
  3. Make a HTTP Post request to request data
  4. Thing starts reciving data

Your thing crashes, you fix it, all your subscriptions are now dead for that socket go to step 3, there are no retries

(eventsub is at leat once so a socket may get a duplicate)

TLDR

The only real differences between the two are

  • Websockets REQUIRES user auth, webhooks only if that topic is scoped
  • On a crash Websockets you have to remake all your subscriptions
  • Webhooks, if using “the cloud” your listener can “sleep” between calls (as long as it wakes up quickly enough when data occurs)

The operational different between the two transports isn’t that different.

Broadly, for most use cases, Webhooks are the more optimal approach in my opinion.

So what is the problem you are facing?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.