Answer the question
In order to leave comments, you need to log in
How to update only those chats that the user does not see yet?
Hello.
The logic is this:
- A person went to the site - all the chats were loaded for him
- Then Ajax cuts in, which checks every second if there are new chats and gives out fresh ones.
Here, how to unload only dialogs that the user does not see?
From the obvious - to make some kind of variable where each chat will unload its id and ajax function, each time it will be sent, sorted by it. But is there a better way?
Answer the question
In order to leave comments, you need to log in
he downloaded all the chatswhy?
In order not to bother with web sockets, it is better not to fence the bike with ajax, but to use the saas comet server . It will work right away, and it doesn’t take much work. And then, when it becomes clear whether it is necessary or not, you can already switch to an open source solution and host it on your own vps. Moreover, these two solutions have the same API and therefore you won’t have to change anything in the code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question