| 15805 | } |
| 15806 | } |
| 15807 | async #run() { |
| 15808 | this.#running = true; |
| 15809 | const queue = this.#queue; |
| 15810 | while (!queue.isEmpty()) { |
| 15811 | const node = queue.shift(); |
| 15812 | if (node.promise !== null) { |
| 15813 | await node.promise; |
| 15814 | } |
| 15815 | this.#socket.write(node.frame, node.callback); |
| 15816 | node.callback = node.frame = null; |
| 15817 | } |
| 15818 | this.#running = false; |
| 15819 | } |
| 15820 | }; |
| 15821 | function createFrame(data, hint) { |
| 15822 | return new WebsocketFrameSend(toBuffer(data, hint)).createFrame(hint === sendHints.text ? opcodes.TEXT : opcodes.BINARY); |