/opt/canhelp/node_modules/engine.io-client/build/esm/transports
NameSizeModeActions
index.d.ts2450644editdlrm
index.js2170644editdlrm
polling-fetch.d.ts4540644editdlrm
polling-fetch.js18750644editdlrm
polling-xhr.d.ts25210644editdlrm
polling-xhr.js82330644editdlrm
polling-xhr.node.d.ts3850644editdlrm
polling-xhr.node.js7320644editdlrm
polling.d.ts11640644editdlrm
polling.js39490644editdlrm
websocket.d.ts11520644editdlrm
websocket.js43940644editdlrm
websocket.node.d.ts5550644editdlrm
websocket.node.js14460644editdlrm
webtransport.d.ts5850644editdlrm
webtransport.js29780644editdlrm
Edit: /opt/canhelp/node_modules/engine.io-client/build/esm/transports/webtransport.js (2978B)
import { Transport } from "../transport.js"; import { nextTick } from "../globals.node.js"; import { createPacketDecoderStream, createPacketEncoderStream, } from "engine.io-parser"; /** * WebTransport transport based on the built-in `WebTransport` object. * * Usage: browser, Node.js (with the `@fails-components/webtransport` package) * * @see https://developer.mozilla.org/en-US/docs/Web/API/WebTransport * @see https://caniuse.com/webtransport */ export class WT extends Transport { get name() { return "webtransport"; } doOpen() { try { // @ts-ignore this._transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]); } catch (err) { return this.emitReserved("error", err); } 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(); } }