Here is js code
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) { onOpen(evt) };
websocket.onclose = function(evt) { onClose(evt) };
websocket.onmessage = function(evt) { onMessage(evt) };
websocket.onerror = function(evt) { onError(evt) };
websocket.send('some_message');
It connects to wsUri, bind some handlers and send "some_message" to the server. How can I do that in PHP? I want to send message to wsUri from another php script.
The simplest solution would be to use a WebSocket Client-Server library for PHP and simply use the Client part in your script. There seems to be a number of available solutions: