Dona
Dona

Reputation: 21

Vue continuous sync with node api

I need to continuously sync with backend API. What are the changes done in backend it should be reflect back to front end in vue? How to continuously sync with API? Is the only way to set interval and call API or is there a better way?

Upvotes: 0

Views: 253

Answers (2)

ahmed alsfary
ahmed alsfary

Reputation: 1

i use Key id for update real time table from json file .

Upvotes: 0

T. Short
T. Short

Reputation: 3614

If you only require that the frontend receive information from the backend then you could use something called a stream. You could create a readable stream that your Vue app listens to.

https://developer.mozilla.org/en-US/docs/Web/API/Streams_API

If you require that the front and backend communicate with each other, then you could use web sockets:

https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

A very popular javascript library for this is socket.io.

https://socket.io/

There are a lot of guides on the internet about how to set it all up. If you have any further questions, I recommend creating separate questions on SO.

Upvotes: 2

Related Questions