1. Go to this page and download the library: Download francium/diffsocket library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace Fr\DiffSocket\Service;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class SayHello implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn){
echo "New Connection - " . $conn->resourceId;
}
public function onClose(ConnectionInterface $conn){}
public function onError(ConnectionInterface $conn, $error){}
public function onMessage(ConnectionInterface $conn, $message){
$conn->send("Hello");
}
}