优化推送消息
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user