I have been trying to figure out a way to approach this. I am working on a messenger like feature with infinite scroll that fetches new items from bottom to top. Limit is set on the client side within the subscription. What I am looking to achieve:
- Increase the query limit within publish (server side) that user is subscribed to when new documents were added to the whole collection, without having to do a round-trip server-client-server
Right now I am using count to evaluate the changes in the collection not constrained by limit. Within my Publish I have:
Total count via publish-counts package
Find with limit params given by the subscription.
I am already using an observer on my Publish cursor, and thus when a new message is added to the collection, I am preventing the delete in ‘removed’ observer.
Is there a way to store params on the server side in a Publish function? I feel that would be more elegant and would allow me to differentiate between user deleted messages and collection shifts. I don’t really want to observe the whole collection as I feel it would be really taxing on the performance. I would appreciate it if someone knows and shares a better way to do it, thanks