in , , , ,

Building a Live Stream Feed for Twitch Extensions

- Werbung -
Reading Time: 6 minutes

Notify your Discord and website when streamers go live with your Extension!

– Werbung –
- Werbung -

"use strict"; var adace_load_6632cc731235a = function(){ var viewport = $(window).width(); var tabletStart = 601; var landscapeStart = 801; var tabletEnd = 961; var content = '%3Cdiv%20class%3D%22adace_adsense_6632cc7312330%20adace-hide-on-phone%20adace-hide-on-landscape%22%3E%3Cscript%20async%20src%3D%22%2F%2Fpagead2.googlesyndication.com%2Fpagead%2Fjs%2Fadsbygoogle.js%22%3E%3C%2Fscript%3E%0A%09%09%3Cins%20class%3D%22adsbygoogle%22%0A%09%09style%3D%22display%3Ablock%3B%22%0A%09%09data-ad-client%3D%22ca-pub-2933510995499028%22%0A%09%09data-ad-slot%3D%226037521357%22%0A%09%09data-ad-format%3D%22auto%22%0A%09%09%3E%3C%2Fins%3E%0A%09%09%3Cscript%3E%28adsbygoogle%20%3D%20window.adsbygoogle%20%7C%7C%20%5B%5D%29.push%28%7B%7D%29%3B%3C%2Fscript%3E%3C%2Fdiv%3E'; var unpack = true; if(viewport=tabletStart && viewport=landscapeStart && viewport=tabletStart && viewport=tabletEnd){ if ($wrapper.hasClass('.adace-hide-on-desktop')){ $wrapper.remove(); } } if(unpack) { $self.replaceWith(decodeURIComponent(content)); } } if($wrapper.css('visibility') === 'visible' ) { adace_load_6632cc731235a(); } else { //fire when visible. var refreshIntervalId = setInterval(function(){ if($wrapper.css('visibility') === 'visible' ) { adace_load_6632cc731235a(); clearInterval(refreshIntervalId); } }, 999); }

})(jQuery);

This is a guest post by Matt Condon (Thanks, Matt! 👋), one half of the two-person team at dot that builds the Stickers Extension.

The Stickers Extension turns any stream into a canvas for viewers where viewers receive rare digital stickers that they place on-stream for everyone to see in real-time. Each time a viewer places a sticker on-stream, every viewer sees it for a few seconds and the Extension gives the placer a shout-out in chat. Subscribers can claim a free sticker ticket every week, and since each sticker is a scarce, unique item, stickers placed on a stream are now owned by the streamer, who can spread the love to other channels.

Recently, as part of the Stickers website and Discord, we added a live feed of channels that are streaming with the Stickers Extension enabled. With live channels on the Stickers website, prospective streamers can easily see Stickers live on an active streamer’s channel, helping them understand how it will look on their own channel and affect their viewers. Plus, with the live feed in Discord, chatters see when a new streamer goes live, as social proof that the Stickers Extension is being used across Twitch.

We have so many live streamer notifications that I’m tempted to mute the channel, but I love knowing when a new streamer joins the Sticker fam.

The stickers website with a list of live channels in the footer.
The Stickers Bot posting a live notification for FluxFer in the #live-with-stickers channel in the Stickers Discord.

We’ll show you how to build a feed of live channels for your own Extension and how to integrate it into your own Discord channel and website. We’ll assume basic knowledge of Lambda and basic understanding of how to use databases like DynamoDB, but you can use the technique here with any technology stack you choose.

How the Live Channel Feed Works

The live channel feed consists of two separate outputs:

  1. A list of all of the currently active channels in order to display them on the website.
  2. A feed of new channels going live in order to post messages in the Discord.

The Twitch Extension API provides the useful endpoint live_activated_channels which returns a paginated list of channels that are live with your Extension activated. We’ll periodically ask Twitch for a list of live activated channels and then do our own processing to create a list of channels and a feed of newly live channels. Note that streamers will take a few minutes to show up in the list provided by this endpoint, so if you’re looking for by-the-second updates on when streamers go live, read the Twitch documentation–specifically the Webhook support via stream_changed.

Backend Architecture

At dot we rely heavily on AWS, among others, for our backend infrastructure — Stickers is a real-time serverless application that has run with 100 percent uptime over the last two months.

We leverage AWS’s serverless-friendly products like Lambda, DynamoDB, AppSync, and CloudWatch in particular to drive the live feed.