88 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-01-25 10:46:42 +01:00
import { EngineRequest, Transport } from "../transport";
import type { Packet, RawData } from "engine.io-parser";
2023-10-10 22:00:26 +02:00
export declare class Polling extends Transport {
maxHttpBufferSize: number;
httpCompression: any;
2025-01-25 10:46:42 +01:00
private req;
2023-10-10 22:00:26 +02:00
private res;
private dataReq;
private dataRes;
private shouldClose;
private readonly closeTimeout;
/**
* HTTP polling constructor.
*/
constructor(req: any);
/**
* Transport name
*/
get name(): string;
/**
* Overrides onRequest.
*
2025-01-25 10:46:42 +01:00
* @param {EngineRequest} req
* @package
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
onRequest(req: EngineRequest): void;
2023-10-10 22:00:26 +02:00
/**
* The client sends a request awaiting for us to send data.
*
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
private onPollRequest;
2023-10-10 22:00:26 +02:00
/**
* The client sends a request with data.
*
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
private onDataRequest;
2023-10-10 22:00:26 +02:00
/**
* Processes the incoming data payload.
*
2025-01-25 10:46:42 +01:00
* @param data - encoded payload
* @protected
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
onData(data: RawData): void;
2023-10-10 22:00:26 +02:00
/**
* Overrides onClose.
*
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
onClose(): void;
2025-01-25 10:46:42 +01:00
send(packets: Packet[]): void;
2023-10-10 22:00:26 +02:00
/**
* Writes data as response to poll request.
*
* @param {String} data
* @param {Object} options
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
private write;
2023-10-10 22:00:26 +02:00
/**
* Performs the write.
*
2025-01-25 10:46:42 +01:00
* @protected
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
protected doWrite(data: any, options: any, callback: any): void;
2023-10-10 22:00:26 +02:00
/**
* Compresses data.
*
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
private compress;
2023-10-10 22:00:26 +02:00
/**
* Closes the transport.
*
2025-01-25 10:46:42 +01:00
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
doClose(fn: () => void): void;
2023-10-10 22:00:26 +02:00
/**
* Returns headers for a response.
*
2025-01-25 10:46:42 +01:00
* @param {http.IncomingMessage} req
* @param {Object} headers - extra headers
* @private
2023-10-10 22:00:26 +02:00
*/
2025-01-25 10:46:42 +01:00
private headers;
2023-10-10 22:00:26 +02:00
}