Closed ilijaNL closed 2 years ago
@Rusfighter: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/
Thanks for this @ilijaNL and sorry we haven't responded sooner (I wish I could say 4 years is a new record 😳). This is an interesting idea but it's a pretty significant change to this library, and doesn't really add functionality the needs to be explicitly handled by this library (this can be done outside of it). For features of this nature it's a great idea to open an issue first to discuss the idea and approach with the community, and gain support for the feature you would like to add, before diving into the implementation. I'll close this for now, but thanks again!
Support for a backlog mechanism in a asynciterator. Can be used to create backlog of publish events. This is especially useful for chat applications such as whatsapp and any other application that are dealing with bad connection.
Usage: First implement the PersistenceClient interface for your data storage, my implementation of mongodb:
Secondly, decorate your pubsub system
Publish events with the decorator:
Return the asyncIteratorWithPersistence from the decorator in subscribe:
You can pass the lastSequence (cursor) parameter in the socketConnection or as args in the subscription and don't forget to update on every new call.