How to properly live update data on a page.

Hey all

For a multitude of cases, I would like to be able to, somehow, connect to data from a collection and have it refresh when something is added or updated. How are we supposed to do this inside Corvid?

For instance:
page 1: I show a paragraph with text from a collection. “hello world”.
I update this content on page 2.
Without refreshing, page 1 updates.

What is the correct Wix way of setting this behaviour up?

Are you talking about data that gets updated from different devices by different users?

For most of the cases it would be the same user id on different devices. In the future it would be nice to have the same logic for different users on different devices yes. (We’re making some sort of a dynamic website game)

@robin25113 so you should use wix-realtime for that.
You should subscribe to a channel on the relevant pages, and use afeterUpdate and afterUnsert hooks to publish a message to the pages. Once a new message received you should refresh the dataset. See:
https://www.wix.com/velo/reference/wix-realtime
https://www.wix.com/velo/reference/wix-data/hooks
https://www.wix.com/velo/reference/wix-dataset/dataset/refresh