コード例 #1
0
ファイル: server.php プロジェクト: Silxik/webgl
function removeUser($clientID)
{
    global $users;
    $name = $users[$clientID]->name;
    unset($users[$clientID]);
    foreach ($users as $userID => $data) {
        wsSend($userID, 'Q ' . $name);
        unset($users[$userID]->queue[$clientID]);
    }
    echo "({$clientID}){$name} left.\n";
}
コード例 #2
0
function sendChat($username, $text)
{
    // sends chat text to all clients
    global $users;
    foreach ($users as $clientID => $user) {
        wsSend($clientID, 'ONTEXT ' . $username . ' ' . $text);
    }
}