Gateway::closeClient

说明:

  1. void Gateway::closeClient(string $client_id);

断开与client_id对应的客户端的连接

参数

  • $client_id

全局唯一标识客户端连接的id

范例

  1. use \GatewayWorker\Lib\Gateway;
  2. class Events
  3. {
  4. ...
  5. public static function onMessage($client_id, $message)
  6. {
  7. // 如果传递的消息不ok就踢掉对应客户端
  8. $is_ok = your_check_fun($message);
  9. if(!$is_ok)
  10. {
  11. Gateway::closeClient($client_id);
  12. }
  13. }
  14. ...
  15. }