(apiBaseUrl: string, sessionId: string)
| 39 | * and /v1/ for production (Envoy rewrites /v1/ → /v2/). |
| 40 | */ |
| 41 | export function buildSdkUrl(apiBaseUrl: string, sessionId: string): string { |
| 42 | const isLocalhost = |
| 43 | apiBaseUrl.includes('localhost') || apiBaseUrl.includes('127.0.0.1') |
| 44 | const protocol = isLocalhost ? 'ws' : 'wss' |
| 45 | const version = isLocalhost ? 'v2' : 'v1' |
| 46 | const host = apiBaseUrl.replace(/^https?:\/\//, '').replace(/\/+$/, '') |
| 47 | return `${protocol}://${host}/${version}/session_ingress/ws/${sessionId}` |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Compare two session IDs regardless of their tagged-ID prefix. |
no outgoing calls
no test coverage detected