sendToGroup

TCP/WebSocket可以使用。

向Group组广播消息。

在集群模式下同样可以使用。

函数原型:

    /**
     * 发送给群
     * @param $groupId
     * @param $data
     */
    public function sendToGroup($groupId, $data)

例子:

   /**
     * 效率测试
     * @throws \Server\CoreBase\SwooleException
     */
    public function efficiency_test()
    {
        $data = $this->client_data->data;
        $this->sendToGroup(10000$data);
    }

集群模式会告诉Dispatch进行群广播。

results matching ""

    No results matching ""