Skip to content

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

@swatchion

Description

@swatchion

如题,感谢。

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions