swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.03k stars 388 forks source link

为什么在使用websocket服务时,触发on connect回调的时候发送消息给指定userid的人,自己也会收到消息 #548

Closed lwl737 closed 10 months ago

lwl737 commented 10 months ago

$websocket->toUserId(['account_154'])->emit('message',"312321321");
发送方 和 接收方 都收到了该信息 我该怎么样才能只发送给接收方

lwl737 commented 10 months ago

加broadcast()就行 $websocket->broadcast()->toUserId(['account_154'])->emit('message',"312321321");