Pjax, Ajax, Yii 2, how to update the content on the side of the interlocutor?
The bottom line is, there is a base data, where the stored correspondence many different dialogues, each dialogue for two people. When writing a message with his hand Pjax works and I without a reboot see what is written to the interlocutor, but the interlocutor correspondence is not updated. What complicates the very correspondence, update the page by hand is unacceptable!
There id who wrote, id who has written, token is a unique correspondence(dialogue).
Tell me, where is the solution. I will be very grateful to know how it looks and works.
Of course you can implement everything using Ajax to send a request which monitors new message, etc., but this method of spike and fit only for very small projects. In General writing chat php as I don't really fit, but if You for some reason have chosen, it is better to realize it's all socket-based
Henderson_Beat answered on July 2nd 19 at 14:21
supports Your problem in the wrong choice of tool. To make chat need via sockets. With the usual ajax will be difficult.
However, in html5 there is a worker-s, here is the article, I think what You should do: https://habrahabr.ru/post/132785/