Open gitlky opened 3 years ago
Are you using socket.io?
@Arkanius i'm using websockt
I wanna notify all online websocket user do something after the queue job finish; I'm sure the queue job is worked,because the log is printed, and client was Connected; but the all websocket client dose't received message from server
In a nutshell:
Websocket::broadcast()->emit('starting',[]);
work in Controller,
inoperation in Queue Job
GenBarcodeJob::dispatch();
我想在队列作业完成后通知所有在线 websocket 用户做一些事情; 我确定队列作业有效,因为打印了日志,并且客户端已连接; 但是所有 websocket 客户端都没有收到来自服务器的消息
简而言之:
Websocket::broadcast()->emit('starting',[]);
在Controller中 工作,在Queue Job中不操作GenBarcodeJob::dispatch();
Friend, has your problem been solved?
Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)
php -v
andphp --ri swoole
)Swoole => enabled Author => Swoole Team team@swoole.com Version => 4.6.5 Built => Apr 14 2021 20:52:21 coroutine => enabled with boost asm context epoll => enabled eventfd => enabled signalfd => enabled spinlock => enabled rwlock => enabled zlib => 1.2.11 brotli => E16777225/D16777225 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled async_redis => enabled
Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608
Laravel Framework 8.37.0
^2.8
<?php
namespace App\Jobs;
use Log; use Illuminate\Bus\Queueable; use Illuminate\Console\Command; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; use SwooleTW\Http\Websocket\Facades\Websocket;
class GenBarcodeJob implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
}