PATH:
opt
/
bitninja-threat-hunting
/
node_modules
/
engine.io-client
/
build
/
esm
/
transports
import { Transport } from "../transport.js"; import { nextTick } from "./websocket-constructor.js"; import { createPacketDecoderStream, createPacketEncoderStream, } from "engine.io-parser"; export class WT extends Transport { get name() { return "webtransport"; } doOpen() { // @ts-ignore if (typeof WebTransport !== "function") { return; } // @ts-ignore this.transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]); this.transport.closed .then(() => { this.onClose(); }) .catch((err) => { this.onError("webtransport error", err); }); // note: we could have used async/await, but that would require some additional polyfills this.transport.ready.then(() => { this.transport.createBidirectionalStream().then((stream) => { const decoderStream = createPacketDecoderStream(Number.MAX_SAFE_INTEGER, this.socket.binaryType); const reader = stream.readable.pipeThrough(decoderStream).getReader(); const encoderStream = createPacketEncoderStream(); encoderStream.readable.pipeTo(stream.writable); this.writer = encoderStream.writable.getWriter(); const read = () => { reader .read() .then(({ done, value }) => { if (done) { return; } this.onPacket(value); read(); }) .catch((err) => { }); }; read(); const packet = { type: "open" }; if (this.query.sid) { packet.data = `{"sid":"${this.query.sid}"}`; } this.writer.write(packet).then(() => this.onOpen()); }); }); } write(packets) { this.writable = false; for (let i = 0; i < packets.length; i++) { const packet = packets[i]; const lastPacket = i === packets.length - 1; this.writer.write(packet).then(() => { if (lastPacket) { nextTick(() => { this.writable = true; this.emitReserved("drain"); }, this.setTimeoutFn); } }); } } doClose() { var _a; (_a = this.transport) === null || _a === void 0 ? void 0 : _a.close(); } }
[-] webtransport.js
[edit]
[-] xmlhttprequest.browser.js
[edit]
[-] websocket-constructor.d.ts
[edit]
[-] webtransport.d.ts
[edit]
[-] xmlhttprequest.browser.d.ts
[edit]
[+]
..
[-] index.d.ts
[edit]
[-] websocket.js
[edit]
[-] polling.js
[edit]
[-] websocket.d.ts
[edit]
[-] xmlhttprequest.js
[edit]
[-] polling.d.ts
[edit]
[-] index.js
[edit]
[-] websocket-constructor.browser.d.ts
[edit]
[-] websocket-constructor.browser.js
[edit]
[-] websocket-constructor.js
[edit]
[-] xmlhttprequest.d.ts
[edit]