laravel-swoole icon indicating copy to clipboard operation
laravel-swoole copied to clipboard

Websocket emit doesn't work in another console

Open xelakz opened this issue 5 years ago • 7 comments

Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)

  1. Please provide your PHP and Swoole version. (php -v and php --ri swoole)
  • php 7.2.27
  • swoole 4.4.15
  1. Please provide your Laravel/Lumen version.
  • laravel 6.x
  1. Which release version of this package are you using?
  • ^2.6
  1. 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');

}

}`

  1. What did you expect to see?
  • I expected the websocket to emit the data to my client
  1. 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.

xelakz avatar Feb 07 '20 08:02 xelakz

Hi, Are you sure you've installed Swoole?

yoviprasetyo avatar Mar 06 '20 17:03 yoviprasetyo

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

sdhou avatar Apr 28 '20 07:04 sdhou

I also encountered the same problem -----------------+-----------------------------------------------+ | PHP Version | 7.3.11 | | Swoole Version | 4.4.17 | | Laravel Version | 7.5.2

nifengfanpan avatar May 22 '20 16:05 nifengfanpan

@xelakz @sdhou Have you solved the problem? Can you help me? @albertcht Ask for help

nifengfanpan avatar Jun 22 '20 17:06 nifengfanpan

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

arabnewscms avatar Jul 14 '20 14:07 arabnewscms

我遇到同样的问题 我的信息

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?

nifengfanpan avatar Jul 22 '20 14:07 nifengfanpan

i faced this problem, can anybody solved this?

kiyana76 avatar Jul 31 '22 09:07 kiyana76