* Build the WebSocket URL from config.
(config: DashConfig)
| 267 | * Build the WebSocket URL from config. |
| 268 | */ |
| 269 | function buildWebSocketUrl(config: DashConfig): string { |
| 270 | if (!config.websocket?.url) { |
| 271 | throw new Error('WebSocket URL not configured'); |
| 272 | } |
| 273 | |
| 274 | // Convert HTTP(S) URL to WS(S) |
| 275 | const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; |
| 276 | const host = window.location.host; |
| 277 | |
| 278 | // The config.websocket.url is a path like "/_dash-ws-callback" |
| 279 | return `${wsProtocol}//${host}${config.websocket.url}`; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Disconnect from the WebSocket. |
no outgoing calls
no test coverage detected
searching dependent graphs…