Trying to figure out the best approach to streaming messages in a chat app for realtime delivery and updates (for things like reactions). Currently in testing Im using a simple Stream, that I update the limit of the query based on pagination. This works to get new messages and show reactions on older messages. But it does a bunch of queries as the pagination calls all the previous messages as well.
How can I efficiently call the stream of messages with pagination, but still update when a new message is sent or an old message is updated.