Gateway::getClientCountByGroup

说明:

int Gateway::getClientCountByGroup(mixed $group);

获取某分组当前在线成员数(多少client_id在线)。

参数

  • $group

分组名字

返回值

返回一个数字

范例

use \GatewayWorker\Lib\Gateway;

class Events
{
    ...
    public onConnect($client_id)
    {
        $group = 'romm-1';
        Gateway::joinGroup($client_id, $group);
        var_export(Gateway::getClientCountByGroup($group));
    }
    ...
}

打印出的数据类似如下:

16

results matching ""

    No results matching ""