使用 cboden/ratchet 我得到接口 'Rachet\MessageComponentInterface' 未找到错误

Using cboden/ratchet I got Interface 'Rachet\MessageComponentInterface' not found error

在我的 laravel 5.7 应用程序中,我使用一些在线文档安装了 cboden/ratchet

composer.json :
    "type": "project",
    "require": {
        ...
        "cboden/ratchet": "^0.4.1",

与app/Classes/Socket/Base/BaseSocket.php:

<?php
namespace App\Classes\Socket\Base;

use Rachet\MessageComponentInterface;
use Rachet\ConnectionInterface;

class BaseSocket implements MessageComponentInterface {

    public function onOpen(ConnectionInterface $conn) {

    }

    public function onMessage(ConnectionInterface $conn, $mgs) {

    }

    public function onClose(ConnectionInterface $conn) {

    }

    public function onError(ConnectionInterface $conn, \Exception $e) {

    }

}

和控制台命令 app/Console/Commands/ChatServer.php :

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use App\Classes\Socket\ChatSocket;

class ChatServer extends Command
{
    protected $signature = 'chat_server:serve';

    protected $description = 'chat_server description';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $this->info("Start server!");
        $server= IoServer::factory(
            new HttpServer(
                new WsServer(
                    new ChatSocket()
                )
            ),
            8080
        );

        $server->run();
    }
}

但是控制台中的 运行 命令出现错误:

$ php artisan chat_server:serve
Start server!
PHP Fatal error:  Interface 'Rachet\MessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7

   Symfony\Component\Debug\Exception\FatalErrorException  : Interface 'Rachet\MessageComponentInterface' not found

  at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
     3| 
     4| use Rachet\MessageComponentInterface;
     5| use Rachet\ConnectionInterface;
     6| 
  >  7| class BaseSocket implements MessageComponentInterface {
     8| 
     9|     public function onOpen(ConnectionInterface $conn) {
    10| 
    11|     }


   Whoops\Exception\ErrorException  : Interface 'Rachet\MessageComponentInterface' not found

  at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
     3| 
     4| use Rachet\MessageComponentInterface;
     5| use Rachet\ConnectionInterface;
     6| 
  >  7| class BaseSocket implements MessageComponentInterface {
     8| 
     9|     public function onOpen(ConnectionInterface $conn) {
    10| 
    11|     }

我是不是遗漏了一些声明,或者我必须向 app.php 添加声明? 如果我添加了配置声明,我错过了阅读文档?

更新块#2:

搜索决定我发现了一个意见,我需要为它创建我自己的服务提供商在 Laravel 中正确注册它 我需要执行哪些步骤才能为 "cboden/ratchet" 创建自己的服务提供商?这超出了我的 laravel 经验...

谢谢!

看起来像拼写错误。必须是:

use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;