Skip to content

Commit

Permalink
add ungroup
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed May 18, 2018
1 parent b50f901 commit 00d3038
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Gateway.php
Expand Up @@ -38,7 +38,7 @@ class Gateway extends Worker
*
* @var string
*/
const VERSION = '3.0.8';
const VERSION = '3.0.9';

/**
* 本机 IP
Expand Down Expand Up @@ -805,6 +805,21 @@ public function onWorkerMessage($connection, $data)
}
unset($client_connection->groups[$group], $this->_groupConnections[$group][$connection_id]);
return;
// 解散分组
case GatewayProtocol::CMD_UNGROUP:
$group = $data['ext_data'];
if (empty($group)) {
echo "leave(group) group empty, group=" . var_export($group, true);
return;
}
if (empty($this->_groupConnections[$group])) {
return;
}
foreach ($this->_groupConnections[$group] as $client_connection) {
unset($client_connection->groups[$group]);
}
unset($this->_groupConnections[$group]);
return;
// 向某个用户组发送消息 Gateway::sendToGroup($group, $msg);
case GatewayProtocol::CMD_SEND_TO_GROUP:
$raw = (bool)($data['flag'] & GatewayProtocol::FLAG_NOT_CALL_ENCODE);
Expand Down

0 comments on commit 00d3038

Please sign in to comment.