优化推送消息

This commit is contained in:
2026-04-20 14:49:02 +08:00
parent 1eed3cf0f7
commit ed21f8647e
4 changed files with 23 additions and 5 deletions

View File

@@ -11,12 +11,27 @@ final class PushChannelConfigHelper
{
public static function wsBaseUrl(): string
{
$client = trim((string) config('plugin.webman.push.app.websocket_client'));
if ($client !== '') {
return self::normalizeClientWsBase($client);
}
$ws = (string) config('plugin.webman.push.app.websocket');
$ws = str_replace('websocket://', 'ws://', $ws);
return str_replace('0.0.0.0', '127.0.0.1', $ws);
}
private static function normalizeClientWsBase(string $url): string
{
$url = rtrim(trim($url), '/');
if (str_starts_with($url, 'websocket://')) {
return str_replace('websocket://', 'ws://', $url);
}
return $url;
}
public static function appKey(): string
{
return (string) config('plugin.webman.push.app.app_key');