laravel-swoole
laravel-swoole copied to clipboard
Websocket emit doesn't work in another console
Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)
- Please provide your PHP and Swoole version. (
php -v
andphp --ri swoole
)
- php 7.2.27
- swoole 4.4.15
- Please provide your Laravel/Lumen version.
- laravel 6.x
- Which release version of this package are you using?
- ^2.6
- What did you do? If possible, provide a recipe for reproducing the error.
`<?php
namespace App\Console\Commands;
use Illuminate\Console\Command; use SwooleTW\Http\Websocket\Facades\Websocket;
class TestCommandSendSocketData extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'test:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Test Send';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Websocket::broadcast()->emit('test', 'test data');
}
}`
- What did you expect to see?
- I expected the websocket to emit the data to my client
- What did you see instead?
Illuminate\Contracts\Container\BindingResolutionException : Target class [swoole.websocket] does not exist.
Exception trace:
1 ReflectionException::("Class swoole.websocket does not exist") /frontend/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
2 ReflectionClass::__construct("swoole.websocket") /frontend/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
Please use the argument -v to see more details.
Hi, Are you sure you've installed Swoole?
I also encountered the same problem php artisan swoole: http start so no problem Pushing information to the client in the console will report an error
I also encountered the same problem -----------------+-----------------------------------------------+ | PHP Version | 7.3.11 | | Swoole Version | 4.4.17 | | Laravel Version | 7.5.2
@xelakz @sdhou Have you solved the problem? Can you help me? @albertcht Ask for help
i faced same issue my information
Swoole => enabled Author => Swoole Team <[email protected]> Version => 4.5.0-alpha Built => Feb 9 2020 16:11:01 coroutine => enabled kqueue => enabled rwlock => enabled pcre => enabled zlib => 1.2.11 async_redis => enabled
我遇到同样的问题 我的信息
Swoole => enabled Author => Swoole Team <[email protected]> Version => 4.5.0-alpha Built => Feb 9 2020 16:11:01 coroutine => enabled kqueue => enabled rwlock => enabled pcre => enabled zlib => 1.2.11 async_redis => enabled
Hi Have you solved the problem?
i faced this problem, can anybody solved this?