* @see https://websockets.spec.whatwg.org/#dom-websocket-send * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data
(data)
| 18385 | /** |
| 18386 | * @param {string} url |
| 18387 | * @param {string|string[]} protocols |
| 18388 | */ |
| 18389 | constructor(url, protocols = []) { |
| 18390 | super(); |
| 18391 | /** |
| 18392 | * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol |
| 18393 | */ |
| 18394 | __privateAdd(this, _onConnectionEstablished); |
| 18395 | __privateAdd(this, _events, { |
| 18396 | open: null, |
| 18397 | error: null, |
| 18398 | close: null, |
| 18399 | message: null |
| 18400 | }); |
| 18401 | __privateAdd(this, _bufferedAmount, 0); |
| 18402 | __privateAdd(this, _protocol, ""); |
| 18403 | __privateAdd(this, _extensions, ""); |
| 18404 | /** @type {SendQueue} */ |
| 18405 | __privateAdd(this, _sendQueue, void 0); |
| 18406 | webidl.util.markAsUncloneable(this); |
| 18407 | const prefix = "WebSocket constructor"; |
| 18408 | webidl.argumentLengthCheck(arguments, 1, prefix); |
| 18409 | const options = webidl.converters["DOMString or sequence<DOMString> or WebSocketInit"](protocols, prefix, "options"); |
| 18410 | url = webidl.converters.USVString(url, prefix, "url"); |
| 18411 | protocols = options.protocols; |
| 18412 | const baseURL = environmentSettingsObject.settingsObject.baseUrl; |
| 18413 | let urlRecord; |
| 18414 | try { |
| 18415 | urlRecord = new URL(url, baseURL); |
| 18416 | } catch (e) { |
| 18417 | throw new DOMException(e, "SyntaxError"); |
| 18418 | } |
| 18419 | if (urlRecord.protocol === "http:") { |
| 18420 | urlRecord.protocol = "ws:"; |
| 18421 | } else if (urlRecord.protocol === "https:") { |
| 18422 | urlRecord.protocol = "wss:"; |
| 18423 | } |
nothing calls this directly
no test coverage detected