laravel-websockets 运行良好,可以通过它从 Laravel 广播事件,并从前端 vueJS 监听它。websocket cli 运行正常,控制台时不时会报错:
Unhandled promise rejection with TypeError: React\Http\Io\ClientRequestStream::closeError(): Argument #1 ($error) must be of type Exception, TypeError given, called in /home/web/public_html/vendor/react/promise/src/Internal/RejectedPromise.php on line 73 and defined in /home/web/public_html/vendor/react/http/src/Io/ClientRequestStream.php:254
不影响使用,如果想解决这个问题,可以指定安装包:
composer require react/promise:^2.3
重新运行:
php artisan websocket:serve
问题就解决啦!
参考:https://github.com/beyondcode/laravel-websockets/issues/1139