I am writing a piece of software that connects to a Meteor server via DDP to read data.
The problem I am facing is figuring out how to differentiate between a NEW document getting added to a collection and getting notified about already-existing documents.
When I first connect to the server, I get a series of added
messages to populate the clientside collection. I don't know how to differentiate between those messages, and the ones that come later, indicating a new document was added live. This gets even worse when the DDP client needs to reconnect to the server, at which point all of the current documents are again sent as added
messages.
added
before theready
message arrives for that subscription id. I'm pretty sure that this is what fires theMeteor.subscribe
callback referred to in the linked^2 example. HOWEVER, I am not convinced that thisready
message is actually guaranteed to arrive after all the initialadded
messages, which means that this technique might not be reliable. Please let me know if you'd like an example and I will happily post. I'd also love to know what MDG suggest! – Eliathan