Many highload websites are able to notify their users of new messages or topics in real-time without the need for page refreshing. How do they achieve this and what approaches are commonly used?
There appear to be two main methods:
- Continuously querying the server using JavaScript at regular intervals
- Utilizing websockets
It is often thought that the first method can put too much strain on the server due to the high volume of requests generated.
As for the behavior of the second method in highload applications, there is limited information available. Is it a suitable approach for such scenarios?
Therefore, which design approach should be used to efficiently implement features like "new message available" without requiring page reloads? This question is primarily focused on performance :)