Gateway::getClientCountByGroup

说明:

  1. int Gateway::getClientCountByGroup(mixed $group);

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

参数

  • $group

分组名字

返回值

返回一个数字

范例

  1. use \GatewayWorker\Lib\Gateway;
  2. class Events
  3. {
  4. ...
  5. public onConnect($client_id)
  6. {
  7. $group = 'romm-1';
  8. Gateway::joinGroup($client_id, $group);
  9. var_export(Gateway::getClientCountByGroup($group));
  10. }
  11. ...
  12. }

打印出的数据类似如下:

  1. 16