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"; }
function sendChat($username, $text) { // sends chat text to all clients global $users; foreach ($users as $clientID => $user) { wsSend($clientID, 'ONTEXT ' . $username . ' ' . $text); } }