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 and php --ri swoole)
php -v
PHP 8.0.5 (cli) (built: May 3 2021 11:30:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.5, Copyright (c) Zend Technologies
with Zend OPcache v8.0.5, Copyright (c), by Zend Technologies
php --ri swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.6.7-dev
Built => May 8 2021 16:50:55
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1f 31 Mar 2020
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => 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
Please provide your Laravel/Lumen version.
Laravel Framework Lumen (8.2.3) (Laravel Components ^8.0)
Which release version of this package are you using?
v2.8.1
What did you do? If possible, provide a recipe for reproducing the error.
<?php
use Illuminate\Http\Request;
use SwooleTW\Http\Websocket\Facades\Websocket;
/*
|--------------------------------------------------------------------------
| Websocket Routes
|--------------------------------------------------------------------------
*/
Websocket::on('connect', function ($websocket, $request) {
// in connect callback, illuminate request will be injected here
$websocket->emit('message', 'welcome');
});
What did you expect to see?
Emit the 'message' event as it's shown above. I'm using socket.io v4.0 on client side and it connects properly to server, even I'm able to print a console message on connect event, but when I try to emit an event from server it fails and if I emit an event from the client side to the server, the server doesn't detect it.
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
)Please provide your Laravel/Lumen version. Laravel Framework Lumen (8.2.3) (Laravel Components ^8.0)
Which release version of this package are you using? v2.8.1
What did you do? If possible, provide a recipe for reproducing the error.
What did you expect to see? Emit the 'message' event as it's shown above. I'm using socket.io v4.0 on client side and it connects properly to server, even I'm able to print a console message on connect event, but when I try to emit an event from server it fails and if I emit an event from the client side to the server, the server doesn't detect it.
What did you see instead?