# Gateway::leaveGroup
## 說明:
~~~
void Gateway::leaveGroup(string $client_id, mixed $group);
~~~
將client_id從某個組中刪除,不再接收該分組廣播(Gateway::sendToGroup)發送的數據。
## 注意:
當client_id下線(連接斷開)時,client_id會自動從它所屬的各個分組中刪除,也就是說無需在onClose回調中調用Gateway::leaveGroup
## 參數
* $client_id
客戶端的client_id
* $group
只能是數字或者字符串。
## 返回值
無返回值
## 范例
~~~
use \GatewayWorker\Lib\Gateway;
class Events
{
...
public static function onMessage($client_id, $message)
{
// $message = '{"type":"leave","group":"xxxxx"}'
$req_data = json_decode($message, true);
Gateway::leaveGroup($client_id, $req_data['group']);
}
...
}
~~~
- 快速入門
- 魔際客服系統V1.0簡介
- 新手上路
- 注冊并創建應用
- 通信過程及聊天記錄保存
- 實時消息回調
- Lib/Geteway類提供的接口
- sendToAll
- sendToClient
- closeClient
- isOnline
- bindUid
- unbindUid
- isUidOnline
- getClientIdByUid
- getUidByClientId
- sendToUid
- joinGroup
- leaveGroup
- sendToGroup
- getClientCountByGroup
- getClientSessionsByGroup
- getAllClientCount
- getAllClientSessions
- setSession
- updateSession
- getSession
- 服務端集成
- 入門
- 用戶體系集成
- 聊天記錄
- 文件上傳下載
- 發送消息
- 群組管理
- 聊天室管理
- 應用管理
- Web IM集成
- Web IM 介紹
- 集成方式
- Web SDK基礎功能
- 消息
- 好友管理
- 群組管理
- 聊天室管理
- 微信小程序 Demo
- Web SDK API Doc
- Web IM SDK 更新日志
- React Native集成
- React Native Demo 介紹