(opcode)
| 17456 | kSentClose: Symbol("sent close"), |
| 17457 | kReceivedClose: Symbol("received close"), |
| 17458 | kByteParser: Symbol("byte parser") |
| 17459 | }; |
| 17460 | } |
| 17461 | }); |
| 17462 | |
| 17463 | // |
| 17464 | var require_util7 = __commonJS({ |
| 17465 | ""(exports, module) { |
| 17466 | "use strict"; |
| 17467 | var { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = require_symbols5(); |
| 17468 | var { states, opcodes } = require_constants5(); |
| 17469 | var { ErrorEvent, createFastMessageEvent } = require_events(); |
| 17470 | var { isUtf8 } = __require("buffer"); |
| 17471 | var { collectASequenceOfCodePointsFast, removeHTTPWhitespace } = require_data_url(); |
| 17472 | function isConnecting(ws) { |
| 17473 | return ws[kReadyState] === states.CONNECTING; |
| 17474 | } |
| 17475 | function isEstablished(ws) { |
| 17476 | return ws[kReadyState] === states.OPEN; |
| 17477 | } |
| 17478 | function isClosing(ws) { |
| 17479 | return ws[kReadyState] === states.CLOSING; |
| 17480 | } |
| 17481 | function isClosed(ws) { |
| 17482 | return ws[kReadyState] === states.CLOSED; |
| 17483 | } |
| 17484 | function fireEvent(e, target, eventFactory = (type, init) => new Event(type, init), eventInitDict = {}) { |
| 17485 | const event = eventFactory(e, eventInitDict); |
| 17486 | target.dispatchEvent(event); |
| 17487 | } |
| 17488 | function websocketMessageReceived(ws, type, data) { |
| 17489 | if (ws[kReadyState] !== states.OPEN) { |
| 17490 | return; |
| 17491 | } |
| 17492 | let dataForEvent; |
| 17493 | if (type === opcodes.TEXT) { |
| 17494 | try { |
| 17495 | dataForEvent = utf8Decode(data); |
no test coverage detected