I am trying to write a bundle on the WebSocket-connection between the client and the server.
And if everything is perfectly chewed by the client on learn.javascript.ru , then nothing concrete about php.

Here is an example from the famous php.net site:

 <?php error_reporting(E_ALL); echo "<h2>Соединение TCP/IP</h2>\n"; /* Получаем порт сервиса WWW. */ $service_port = getservbyname('www', 'tcp'); /* Получаем IP адрес целевого хоста. */ $address = gethostbyname('www.example.com'); 

There are two examples in it, two types: server-server and server-client.
I need a second.
Suppose that the code above is on my server, from where the user has loaded the page. After the page is loaded, a request is made for a script via a web socket, this will work for me.
But I look at the code and see that in the example the connection occurs by url. And I can not understand, this is the url of my resource and we take the ip of the connection that comes from the client request, so that later on it can be used to bind the WebSocket, or do we connect to another server in general?

Honestly, I’m generally floating from websocket to php, but I want to write them in pure php.
I would be very, very grateful for a simple implementation, which would simply output the same message that we sent to the client on the web socket. Then everything would be simple and clear.
I still can not figure it out ...

  • You may be interested in one of my old answers . - D-side
  • @ D-side really, asked this question quite recently, thought even to ask him here, but for the time being he didn’t wait. And here you are here) Thank you. Oh, sorry with the question itself there is no one to help. - VostokSisters

0