Good day! Tell me, how to implement the function of communication on the site, and specifically the verification of new messages? There is, for example, a conversation with the user, I sent him a message and how can I find out if there is an answer from him?

Of course, without frames, preferably the smallest load on the server.


    2 answers 2

    For a smaller load, enter a field with the number of messages in the user table. When someone wrote to the user, do +1 in this field. If >0 then there are messages, besides you can display their number (unread)

    This will be faster than searching the LAN table for unread entries with the current user id

    • That is, with the help of AJAX with some specific interval to send requests? and who knows how in real-time notifications are made? - stasQa
    • looking at what your project is focused on. Perhaps it does not make sense at all to use AJAX with respect to the LAN. --- In VK, messages are written on nodeJS if I'm not mistaken, but on the client side of AJAX with long-polling , Gedweb

    Already asked such a question, use the search.

    • Yes? read your link - stasQa
    • You would put the question correctly. You can use AJAX requests to learn about new developments, or long-polling. - Mobyman