Video by HeyTimDev · streamed from YouTube. All rights remain with the creator.
Lesson 16: Real-Time Chat with Supabase
About this lesson
In this tutorial, HeyTimDev adds a real-time chat feature to the short-video app, so that users can have conversations with their friends that update instantly. It begins by setting up real-time chat using Supabase with React Native, so that messages appear on screen as soon as they are sent without the user needing to refresh. A key part of the video is building a reusable chat component that can be used for both the chat screen and the comments, since both show a list of messages with an input for adding new ones, which saves effort and keeps the app consistent. The video then implements a friends system for messaging, in which only mutual followers can chat with each other, building on the follower relationships set up earlier in the series so that private conversations happen only between people who have chosen to connect. Supabase's real-time subscriptions are used to enable live chat updates, so that the app listens for new messages and adds them to the conversation the moment they arrive. Each private conversation is handled with unique keys for the pair of users involved, so that the messages between two people are kept together and separate from everyone else's. By the end of the video, the app has a fully functional chat feature that updates in real time and allows users to have live conversations with their friends, and the next part brings everything together and refines the chat and profile features. Afterwards, read Chapter 16 of the course book, which works through chat keys and the delays of polling by hand.