Websocket 棘轮腹板套筒-灌注问题

Websocket 棘轮腹板套筒-灌注问题,websocket,installation,ratchet,Websocket,Installation,Ratchet,我读了很多书,但仍在努力让棘轮工作。我正在努力让服务器端shell脚本启动并运行。供应商目录已从其原始安装位置移动,但已整体移动。当我运行php composer.phar update或install时,每次都是不需要更新或安装的 以下是我的目录结构: /var/www/bin/socket.php (server script) /src/CommApp/Comm.php /htmp/ (public site) /vendor/

我读了很多书,但仍在努力让棘轮工作。我正在努力让服务器端shell脚本启动并运行。供应商目录已从其原始安装位置移动,但已整体移动。当我运行php composer.phar update或install时,每次都是不需要更新或安装的

以下是我的目录结构:

/var/www/bin/socket.php (server script)
        /src/CommApp/Comm.php
        /htmp/ (public site)
        /vendor/
        composer.json
        composer.phar
composer.json

{
"autoload": {
    "psr-0": {
        "CommApp": "src"
    }
},
"require": {
    "cboden/ratchet": "0.3.*"
}
}

当我尝试服务器代码的顶级版本时,它可以工作,但我不知道如何绑定到不同的IP,而不是127.0.0.1,我需要绑定到0.0.0.0。所以我在底部找到了这个新版本的代码,它允许我绑定到我需要的ip。buttom代码给了我一个错误 PHP致命错误:在第28行的/var/www/bin/socket.PHP中找不到类“Ratchet\CommApp”

socket.php

<?php
/**
require __DIR__ . '/../vendor/autoload.php';

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use CommApp\Comm;

$server = IoServer::factory(
    new HttpServer(
        new WsServer(
            new Comm()
        )
    ),
    8080
);

$server->run();
 */

 // Ratchet/0.3
$app = new Ratchet\App('www.mysite.com',8080,'0.0.0.0');
$app->route('/CommApp',new Comm);
$app->run();
<?php

namespace CommApp;

use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Comm implements MessageComponentInterface
{

    protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;
    }

    public function onOpen(ConnectionInterface $conn) {
        //store the new connection
        $this->clients->attach($conn);

        echo "someone connected\n";
    }

    public function onMessage(ConnectionInterface $from, $msg) {
        //send the message to all the other clients except the one who sent.
        foreach ($this->clients as $client) {
            if ($from !== $client) {
                $client->send($msg);
            }
        }
    }

    public function onClose(ConnectionInterface $conn) {
        $this->clients->detach($conn);
        echo "someone has disconnected";
    }

    public function onError(ConnectionInterface $conn, \Exception $e) {
        echo "An error has occurred: {$e->getMessage()}\n";
        $conn->close();
    }
}

我不知道我是如何修复它的,但我重新安装了所有东西,而且它工作正常。我认为这与棘轮安装的初始位置有关,但我不能确定