/** The handshake accepts HTTP URLs too; persist the WebSocket form the SDK uses. */ export function normalizeRemoteUrl(value: string): string { const trimmed = value.trim(); try { const url = new URL(trimmed); if (url.protocol === "http:") url.protocol = "ws:"; if (url.protocol === "https:") url.protocol = "wss:"; return url.toString(); } catch { // Keep incomplete input editable. Test connection supplies the validation error. return trimmed; } }