AWS Logo
Menu
Build a UGC Live Streaming App with Amazon IVS: Creating an Amazon IVS Chat Room (Lesson 2.3)

Build a UGC Live Streaming App with Amazon IVS: Creating an Amazon IVS Chat Room (Lesson 2.3)

Welcome to Lesson 2.3 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 Dec 13, 2023

Intro

In lesson 2.1, we saw how StreamCat persists a user to the database in the handler for the /register endpoint within the application and in lesson 2.2 we saw how to create and associate a dedicated Amazon IVS channel for each user. In this lesson, we'll see how the StreamCat application uses the AWS SDK for JavaScript (v3) to create an Amazon IVS chat room for a user.

Creating a ChatRoom

To create a chat room for the new User, we invoke the createChatRoom() method of the ChatRoomService inside of the /register endpoint handler.
The createChatRoom() method uses the IvschatClient from the SDK for JavaScript and sends a CreateRoomCommand. The CreateRoomCommandInput object requires a name property for the chat room. For this, we use the username property of the User entity, to keep an association between the resources for each user. Each ChatRoom references a single, shared messageReviewHandler AWS Lambda function as well as a shared and pre-built chat logging configuration within the loggingConfigurationIdentifiers array. Refer to lesson 1.4 to learn more about these pre-built resources.
The /register endpoint handler collects the channel properties returned in the CreateRoomCommandOutput object, constructs a ChatRoom entity, and associates that entity with the User.

Summary

In this lesson, we learned how the StreamCat application creates an Amazon IVS chat room for each user and associates that chat room with the user. Later on, we'll see how to add live chat to the user's channel page to allow the broadcaster and viewers to interact with one another.

Links

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

Comments