Search code examples
deepstream.io

What is the diff between data-sync and pub-sub in Deepstream


All:

I am pretty new to deepstream, on its website, it described in core concepts section as:

data-sync Interactive JSON documents that can be edited and observed. Changes are persisted and synced across clients.

and

publish-subscribe Many clients can subscribe to topics and receive data whenever other clients publish it to the same topic

I wonder what is the diff between its data-sync and pub-sub in terms of their purpose, in anther way, what task can one do while the other can not?

Thanks


Solution

  • PubSub is a way for clients and servers to send messages to each other. These messages can contain all sorts of data, but once the message is delivered its gone - there's no storage or statefulness. If you're familiar with EventEmitters in e.g. JavaScript you're already familiar with the pattern.

    Data-Sync on the other hand is stateful, persistent data. Clients can request JSON documents called records, update them and subscribe to changes made by other records. Records can be arranged in lists and lists can be referenced by records, allowing for data-sync to become the realtime backbone for all the data that drives your app.