Next.js Discord

Discord Forum

Tracking changes for other people on the same page

Answered
Clumber Spaniel posted this in #help-forum
Open in Discord
Clumber SpanielOP
Lets say there's some change in the database which would change the content of some page - how can i add tracking, so whenever the specific database is changed, i can send "notification" to the currently visiting users with something like "Content of the page has changed"?
Answered by joulev
the only way for a server to send data to a client without the client explicitly requesting it is by real time tech such as websocket
View full answer

5 Replies

Answer
but you can mimic real time by using things like tanstack query which basically polls the server regularly
Clumber SpanielOP
Would you recommend ws? Or maybe other libraries for realtime
i was talking about websocket the protocol. ws is just one of the libraries allowing you to interact with that protocol, you can use any libs you like
Clumber SpanielOP
Alright