delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

Notify only specific user #130

Closed deividas717 closed 7 years ago

deividas717 commented 7 years ago

First of all I want to thank the developers for this amazing project :) Here's my question Imagine I have 100 users. Each has its own unique id. Let one user reserves table at specific time (basically writes to database) now when database is updated all of my users is notified and onDataAdded method is called. Is it possible to call onDataAdded method to only client that has updated database?

ocram commented 7 years ago

Thanks!

This is pretty much a general Meteor question, and not a question related to this library.

But anyway, the important idea is that your subscriptions and publications control which client gets to see certain pieces of information.

If you don't want everybody to receive the new information, you just push it to a publication that only the specific user will (and can) subscribe to, e.g. a publication of notifications that expects the user's ID as a parameter.

If you publish data to a place that all users subscribe to, on the other hand, you will send this update to all users, of course.