Gateway::getAllClientCount

说明:

  1. int Gateway::getAllClientCount(void);

(要求Gateway版本>=2.0.4)

获取当前在线连接总数(多少client_id在线)。

参数

无参数

返回值

返回一个数字

范例

  1. use \GatewayWorker\Lib\Gateway;
  2. class Events
  3. {
  4. ...
  5. public onConnect($client_id)
  6. {
  7. var_export(Gateway::getAllClientCount());
  8. }
  9. ...
  10. }

打印出的数据类似如下:

  1. 32