hyperf / hyperf/socketio-server
服务端从容器中获取 SocketIO 单例, 然后 emit 推送消息给客户端,如果获取客户端收到消息后返回的 ack?
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 26
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
如题,感谢。
比如业务上的一个控制器, 调用此控制器向特定的 客户端 发送消息
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SendMessageController::index and the SocketIO instance obtained through ApplicationContext::getContainer(); trace the to($client_id)->emit('some_event', '消息体')->reply() chain and how client acknowledgements are handled. Done means establishing whether this server-side call can receive the client's ack and defining the expected non-null reply behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100