Files
kiri-core/HttpServer/Emit.php
T
2021-04-12 15:37:13 +08:00

41 lines
551 B
PHP

<?php
namespace HttpServer;
use Exception;
use Snowflake\Abstracts\Component;
use Snowflake\Snowflake;
/**
* Class Emit
* @package HttpServer
*/
class Emit extends Component
{
private array $_array = [];
/**
* @param int[] $users
* @param string $message
* @throws Exception
*/
public function emit(array $users, string $message)
{
$table = Snowflake::app()->getTable('SYSTEM:ONLINE:PEOPLES');
foreach ($users as $user) {
$fd = $table->get((string)$user, ['clientId']);
Snowflake::push($fd, $message);
}
}
}