hyperf / hyperf/socketio-server

服务端从容器中获取 SocketIO 单例, 然后 emit 推送消息给客户端,如果获取客户端收到消息后返回的 ack?

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
26
Forks
6
PR merge metrics
No merged PRs in 30d

Description

如题,感谢。

比如业务上的一个控制器, 调用此控制器向特定的 客户端 发送消息

```php
class SendMessageController{
public function index(){
$socket = ApplicationContext::getContainer()->get(SocketIO::class);
$reply = $socket->to($client_id)->emit('some_event', '消息体')->reply(); // $reply is null ?
}
}

```

以上返回的 reply 为 null

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.