A
A
Alexey Zaitsev2017-11-19 02:05:08
Chats
Alexey Zaitsev, 2017-11-19 02:05:08

How to store information about new private messages in a chat?

For "self-learning" I decided to write a chat using PHP, MYSQL, JS, AJAX. In general, there are "dialogues", roughly speaking like Vkontakte. The server is polled with an ajax request.
I store information about new messages in a file on the server. That is, when a message is sent and when it is read, the file is overwritten. I'm afraid with a large online performance drop and errors.
I think you can increase the number of files, each for a specific group. Or is it better to connect to the database every request and look for new messages there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2017-11-19
@Arik

Write as quickly as possible, the main thing to keep in mind is that if you want to transfer to a database or somewhere else, you didn’t have to rewrite the entire code, but only the part of the code that is responsible for storing data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question