Build a UGC Live Streaming App with Amazon IVS: Following a Channel (Lesson 8.4)

Build a UGC Live Streaming App with Amazon IVS: Following a Channel (Lesson 8.4)

Welcome to Lesson 8.4 in this series where we're looking at building a web based user-generated content live streaming application with Amazon IVS. This entire series is available in video format on the AWS Developers YouTube channel and all of the code related to the sample application used in this series can be viewed on GitHub. Refer to the links at the end of the post for more information.

Todd Sharp
Amazon Employee
Published Jan 8, 2024


In this lesson, we'll learn how the StreamCat application gives users the ability to follow other channels.

Following a Channel

User generated content live streaming applications often give users the ability to "follow" other channels. This feature allows the application to send a notification to followers when a channel begins a live stream. The StreamCat application does not currently send any notifications. Adding support can be done by querying the list of followers in the "Stream Start" event handler AWS Lambda function and sending a notification via email, SMS, or any other channel that makes sense for your application.
To follow a channel, StreamCat creates an entry in the user_channels table that contains both the user's and channel's id property.
User Channels
User Channels
This action is handled by the /channel/follow endpoint which receives the channel id and creates the relationship.
Route.post('/channel/follow', async ({ response, request, auth }) => {
const id = request.body().channelId;
const channel = await Channel.find(id);
if (channel) {
await auth.user?.related('followedChannels').attach([channel.id]);
await channel.refresh();
const followers = await channel.followerCount();
if (followers >= 5 && !channel.isPartner) {
channel.isPartner = true;
ChannelService.updateChannelType(channel.arn, 'ADVANCED_HD', 'HIGHER_BANDWIDTH_DELIVERY');
return response.noContent();
The first part of this endpoint handles the follower relationship. Once the relationship is established, the current followerCount is checked and the "partner" status for a channel is updated accordingly. In this case, if a channel has more than 5 followers, it is upgraded to "partner" status and the channel type is changed from BASIC to ADVANCED_HD.
Obviously this criteria is arbitrary and included to illustrate that channel types can change based on certain business rules. Your use case will dictate whether or not a "partner" feature makes sense and what criteria should apply to such a feature.
The 'channel' page in StreamCat queries the user_channels table to determine the current follower count for a channel and checks the current user's followed channels to update the UI as appropriate. To learn more about how a channel determines whether or not a user follows a channel, refer to lesson 5.1.


In this lesson, we learned how the StreamCat application handles following a channel. In the next lesson, we'll learn how to add chat playback on a VOD.


Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.