Content Deep Dive
Using Presence in in-game chat: Is the other person still there?
Blog post from Ably
Post Details
Company
Date Published
Author
Nate Eagle
Word Count
976
Language
English
Hacker News Points
-
Summary
In this post, the author discusses extending an existing chat app to show when another player leaves the game using Presence data from Ably's React hooks. They create a new component called OpponentPresence that displays a system message and provides a link to start a new game if the opponent is not present. The implementation includes debounce logic to prevent flickers, as well as logic to restart the game if the opponent leaves. Finally, the author suggests using Ably's dashboard for debugging purposes.