I am developing a chat for my site where a user sends an invitation to the other user, if it accepts it will open and the system will be checking for new messages.
For the system to do this, I use a while
, and while it does not return any results, I get the last id
of the memory that I received, I create a query
to bring results greater than the id
provided. After executing a retry and not returning anything I give a sleep
of 1 second in the php to not overload.
I wonder if anyone could build a chat with a different system and how did he do it? Is there any technique that is more performative than long-polling ?