rethinkdb / horizon

Horizon is a realtime, open-source backend for JavaScript apps.
MIT License
6.78k stars 350 forks source link

Allow changefeed subscriptions to determine if an update originated with the client #157

Open segphault opened 8 years ago

segphault commented 8 years ago

There are a lot of cases (particularly when implementing ad hoc optimistic updates) where it would be useful to be able to tell if a given update was caused by action taken by the end user.

For example, when a user sends a message in a chat room, and that update is broadcast to all users, you don't want to handle that update for the user who sent the message because you want to optimistically display it on the client side first.

This is a common enough use case that a lot of realtime frameworks support it out of the box. A few precedents:

deontologician commented 8 years ago

Related to #23

niieani commented 8 years ago

I partially disagree with this part:

you don't want to handle that update for the user who sent the message because you want to optimistically display it on the client side first

There are some cases in which you will want to update locally even if you were the client that triggered the update. See #194 for two such examples.