I'm trying to create a facebook type chat, I'd like to know how it works.
In it we talk and disconnect and after reconnect the old messages history is displayed in perfect order, how to do this?
I'm trying to create a facebook type chat, I'd like to know how it works.
In it we talk and disconnect and after reconnect the old messages history is displayed in perfect order, how to do this?
I think you're forgetting to keep a column with the timestamp of the messages to be able to sort by it, another option is simply to sort by the id of the table, but I find the first option much better. Control the user's session of the time of the last query to the bank to bring only new messages and reduce their bandwidth consumption.
Good advice would also be to invest in some reverse ajax technology, or even a simple websocket (there are some web-ready examples that you can customize well) so your system would only do the queries when really needed and not from time to time. times. I already did a small javascript chat (pretty basic, no bank had) using websockets and it was pretty cool.