(item, cb, hint)
| 15770 | this.#socket = socket; |
| 15771 | } |
| 15772 | add(item, cb, hint) { |
| 15773 | if (hint !== sendHints.blob) { |
| 15774 | if (!this.#running) { |
| 15775 | if (hint === sendHints.text) { |
| 15776 | const { 0: head, 1: body } = WebsocketFrameSend.createFastTextFrame(item); |
| 15777 | this.#socket.cork(); |
| 15778 | this.#socket.write(head); |
| 15779 | this.#socket.write(body, cb); |
| 15780 | this.#socket.uncork(); |
| 15781 | } else { |
| 15782 | this.#socket.write(createFrame(item, hint), cb); |
| 15783 | } |
| 15784 | } else { |
| 15785 | const node2 = { |
| 15786 | promise: null, |
| 15787 | callback: cb, |
| 15788 | frame: createFrame(item, hint) |
| 15789 | }; |
| 15790 | this.#queue.push(node2); |
| 15791 | } |
| 15792 | return; |
| 15793 | } |
| 15794 | const node = { |
| 15795 | promise: item.arrayBuffer().then((ab) => { |
| 15796 | node.promise = null; |
| 15797 | node.frame = createFrame(ab, hint); |
| 15798 | }), |
| 15799 | callback: cb, |
| 15800 | frame: null |
| 15801 | }; |
| 15802 | this.#queue.push(node); |
| 15803 | if (!this.#running) { |
| 15804 | this.#run(); |
| 15805 | } |
| 15806 | } |
| 15807 | async #run() { |
| 15808 | this.#running = true; |
| 15809 | const queue = this.#queue; |
nothing calls this directly
no test coverage detected