Chat Pagination with Infinite Scrolling
To load older messages from the conversation using the Vonage Conversation Client SDK, you need to create a Vonage Application with RTC capabilities, a Vonage Conversation, and a user. You then generate a token for the user and configure the application. The demo app uses infinite scrolling to display historical messages as the user scrolls through the message history. To implement this feature, you add an event listener to detect when the user reaches the oldest message at the top of the message list. When this happens, you load the next page of events by calling the `getNext` method on the last loaded page's object and update the message feed with the new messages. Additionally, you store the scroll height before and after updating the message feed to fix the position where the user was in the channel's message history.
Company
Vonage
Date published
Feb. 3, 2020
Author(s)
Luke Oliff
Word count
2162
Language
English
Hacker News points
None found.