There is a table with messages.
How to make a request so that it returns only those messages that did not receive a response.
That is, there is a table
id|dialog|is_read|mess - это примерная таблица для наглядности 1 |1 |0 |265 2 |1 |1 |ыва 3 |1 |0 |ваи 4 |1 |0 |123
In the table there is a ts field (unix timestamp);
It is necessary to return the last two lines, because the line with id = 1 has already received the answer (id = 2), it’s just that the read mark didn’t have time to go to the server and change.
The dialog field is not a constant; it is a dialog id.
This question is related to this. Instant messages: reading messages - so that it is clear.