I’m building some sort of real-time chat applicati...
# orm-help
i
I’m building some sort of real-time chat application and would like to understand some things. For example I already have a
Subscription
method
receiveMessages
which sends me new messages when they are created and a
Query
method
getMessages
which utilises
Connection
with cursor-based pagination. So, when a user log in into an application, he opens chat and have some messages in cache and then receiving other other messages which he missed. We take the latest available message in cache and pass it to our
getMessages
method and get everything after that message. And if we scroll back to top, it will load with the same method 10 previous messages before last message on the screen at the top. And the problem which I’m trying to figure out is the possibility of loosing any messages on receive when some sort of disconnecting happened on the client side. If anyone could help me out and describe the proper flow for such application I would be glad to hear it out!🙏
h
You can add disconnect listen in apollo client and refetch all the stuff and validate them with the ids of the current cache. That way you can ensure you don't miss anything