Hello! The chat itself took on Habré, here https://habrahabr.ru/post/209864/ Here is the demo for the chat: http://sharoid.ru/chat.html

Put on a local server, everything works. But there was a problem with the hosting. I log in via ssh to the server and run the socket server logic file with the php server.php command and then go to the client page and see the lines:

system: please wait, I try to connect to the server.

system: connection is open

Connection established successfully. But when I try to send a message, nothing happens. Tell me which way to look.

  • I also work crookedly ... By the way, this one is better and easier to remake to fit your needs. sanwebe.com/2013/05/chat/using-websocket-php-socket source at the end of the page;) - And
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • When working with sockets directly, it is very important that there is a deterministic packet size, or the packet ends with \r\n . At the same time, both the client and the server must process the packages in the same way - otherwise, the hang of one of them or both is guaranteed. If you do not want to suffer - use the library of the finished protocol, for example http, or download the library of the already finished chat. Sockets seem to be simple, but incomplete understanding of how they work - causes hangs - nick_n_a

0