Perhaps the question is a little stupid, maybe not even a bit. But I’m wondering, is it possible to create some kind of chat prototype without databases and other repositories? That is, as far as I know, you can connect users to each other, then each connected user will be like the storage itself.

The question is what technology is needed? How about does it work? This is a theoretical question, I hope to see some tips and explanations on why it is useful or not, and where to look at when trying to implement.

  • If you do not need to store the history of messages, why and storage? And if necessary, then this or that storage will be. It is possible to store history in the browser’s local data, but the volume is limited there and everything can be backed up with one hand movement. - teran
  • @teran I do not understand how to make it work. Usually, this is how it works: the user writes a message, it flies to the database, another checks if there is something new in the database, downloads it to himself and so constantly, right? And where to look for the new message if there is no storage? - Telion
  • not at all. The server can send messages to clients. Here, for example, a fresh question on your topic on related technologies: ASP.net + SignalR . In general google on pkhp and sockets. - teran
  • In general terms: start the process-daemon that hangs constantly and accepts connections, and all the data needed for the chat operation is stored in the RAM of this process (the message history can also be stored, but obviously disappears when it is restarted) - andreymal
  • I had to do. Used sharedmemory php.net/manual/ru/book.shmop.php . - Vorobev Alexander

1 answer 1

You can use web socket technology. 2 users connect to the server, as soon as the first one sends a message, the server immediately sends it to the second one without saving anywhere.

If interested, my example of such a chat on node.js (with encryption): https://github.com/Zergatul/zChat

  • On Node.js, I’ve already done this on guides, trying to figure out how to create without guides in PHP :) - Telion
  • A programming language doesn't matter, web sockets are not a language feature, but a network protocol. - Zergatul
  • Maybe I don’t understand something (which is obvious), but the ways of managing protocols are different in different languages. The fact that you wrote a program on node.js may not always mean that you can repeat this in PHP without any help. - Telion