Closed jianhuawang closed 4 years ago
Do you need to send a broadcast message?
@Arkanius Broadcast message is not required. Maybe needed in feture, but now I want to send message by fd through websocket. Do you have some suggestion?
I have find the way.
use SwooleTW\Http\Websocket\Facades\Websocket;
$fd= $mySwooleTable->getFdByUserId($user->id); //$user is the message receiver I want to notice.
$websocket= Websocket::getFacadeRoot();
$websocket->setSender($fd); // this step is not required.
$websocket->to($fd)->emit($event, $data );
Nice job @jianhuawang ! Sorry, I couldn't see this issue yesterday.
PHP Version : 7.3.16
Swoole Version : 4.4.17
Laravel Version : 8.10.0
swooletw/laravel-swoole v2.6.68
I have run websocket server successfuly. now this websocket server received a POST request, after receive the post data, server should send some message throught websocket channel. I have a swoole table saved the fds information. for example: fd=1.
I need help: how to sent some message to fd ( websocket client).