Next step after OAuth

From a high level perspective…

  1. You subscribe to a webhook
  2. Twitch sends back a request with a secret, you have to respond back with the secret, which verifies your subscription to the event
  3. When the event occurs Twitch will send a POST request to the URL that you subscribed on.
  4. You receive the request and then fire an event or whatever you want to do with it

You’re just doing an HTTP GET Request on that URL. Twitch will provide the formatted data, and you parse that. So you’d have to use some form of HTTP request library to handle the request from Twitch, and using callbacks you’d apply that to your front-end. I think generally speaking it’s better to handle the webhook server side and then pass the parsed data onto the client side.

If you’re doing this entirely client side then you need to account for the fact that the data won’t always be there when a user views the page.

EDIT: this looks like it might be helpful. https://www.html5rocks.com/en/tutorials/eventsource/basics/

1 Like