(relativePath)
| 303 | } |
| 304 | |
| 305 | export function getWebsocketUrl(relativePath) { |
| 306 | var location = window.location; |
| 307 | |
| 308 | var https = location.protocol.toLowerCase() === 'https:'; |
| 309 | var wsProtocol = https ? 'wss' : 'ws'; |
| 310 | var hostUrl = wsProtocol + '://' + location.host; |
| 311 | |
| 312 | var dir = getUrlDir(); |
| 313 | if (dir) { |
| 314 | hostUrl += dir; |
| 315 | } |
| 316 | |
| 317 | if (isEmptyString(relativePath)) { |
| 318 | return hostUrl; |
| 319 | } |
| 320 | |
| 321 | if (!hostUrl.endsWith('/')) { |
| 322 | hostUrl += '/'; |
| 323 | } |
| 324 | |
| 325 | return hostUrl + relativePath; |
| 326 | } |
| 327 | |
| 328 | export function isWebsocketClosed(websocket) { |
| 329 | return ((websocket.readyState === 2) || (websocket.readyState === 3)); |
no test coverage detected