added wss tools 2

This commit is contained in:
2026-06-18 14:29:37 +03:30
parent b66a8611cd
commit 30b0e480c3
4 changed files with 77 additions and 26 deletions
+16 -4
View File
@@ -102,15 +102,27 @@ class WebsocketBroadcastService
private function resolveHost(): string
{
$config = app(ConfigService::class);
$appUrl = trim($config->getString('app_url', ''));
if ($appUrl !== '') {
$host = parse_url($appUrl, PHP_URL_HOST);
if (is_string($host) && $host !== '') {
return $host;
}
}
if (! app()->runningInConsole() && request()) {
$requestHost = trim((string) request()->getHost());
if ($requestHost !== '') {
return $requestHost;
}
}
$nameEn = trim((string) $config->getString('name_en', ''));
if ($nameEn !== '') {
return $nameEn;
}
if (! app()->runningInConsole() && request()) {
return trim((string) request()->getHost());
}
return '';
}
}