I have created a Vue app and I have many requests to get data from the database using Axios but if data updated on the server side it will not be updated on the client site in my Vue app, so I made a setInterval every 10 seconds to update the response data from the server-side, my question is, is this way a good practice or there is another better way to make the same result and make my app's data always updated like as same as the server-side to be a realtime database.
Asked
Active
Viewed 11 times
0
-
Maybe [tag:websocket]? – Yeheshuah May 27 '20 at 07:00
-
1Making a request every 10 seconds means *every single visitor* will make a request every 10 seconds. With 10 concurrent visitors, that's already one request per second. You'll be DDoS-ing your own server in no time with this approach. You want to *push* data, which is a web socket or server-side-events. – deceze May 27 '20 at 07:25