I have a server on Node.js. Small amounts of information are thrown to it through sockets, roughly speaking, arrays with 20-30 line elements are no more than 30 characters each. On the server, the information is stored and stored for about 10 minutes. At this moment, different information on the socket is continuously sent, and it behaves the same way. Now the question. I need to organize a moment with the output of information to customers. How to implement the delivery of information more correctly, so that the server is the least tensed. For example, you can connect to the server by socket and transfer all available information when connecting, and occasionally output what was deleted and what was added. Or you can display the current data when the http request, and from the client side to make ajax requests.

    1 answer 1

    You have described the classic Instant Messaging / Notifications task. If you want a smaller load and a more convenient implementation, use WebSockets. Sockets can send information immediately after it is received, this is done only once and there are no continuous polling of the server as with Long Polling. For 2017, WebSockets have wide support and they are already included in the W3C standard, there is no point in contacting AJAX requests.

    • Yes, in the end I did) Thank you! - Roman