Answer the question
In order to leave comments, you need to log in
How to refresh or re-render a page in the browser to refresh from the server?
Hello.
There is an application - social media (network). The server side is written in Node.js.
By visiting the page of a registered user from a browser, the visitor can view his posts.
Now we need to make it so that when the user whose page the visitors are on posts a new post on his page, it is immediately rendered on the pages in the browsers of the current visitors.
What is the problem: the server cannot send a request to the client using HTTP, as far as I know. Using WebSockets is also not really an option, because if there are a million registered accounts, there will be a million socket listeners that will all work simultaneously. And yet, how to notify the client (visitor's browser) about the presence of a new post and configure the processing of this event?
I know about the option of polling the server from the browser at a certain interval for updates. Is this a good implementation? And how to design it correctly, where can I get more information about this approach? Recommend others, if any.
Thank you!
Answer the question
In order to leave comments, you need to log in
In general, this is a websocket, if the network is highly loaded, then 1000 people will constantly hammer the database
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question