|
import type { Packet, RawData } from "engine.io-parser"; |
|
import { Emitter } from "@socket.io/component-emitter"; |
|
import { SocketOptions } from "./socket.js"; |
|
export declare class TransportError extends Error { |
|
readonly description: any; |
|
readonly context: any; |
|
readonly type = "TransportError"; |
|
constructor(reason: string, description: any, context: any); |
|
} |
|
export interface CloseDetails { |
|
description: string; |
|
context?: unknown; |
|
} |
|
interface TransportReservedEvents { |
|
open: () => void; |
|
error: (err: TransportError) => void; |
|
packet: (packet: Packet) => void; |
|
close: (details?: CloseDetails) => void; |
|
poll: () => void; |
|
pollComplete: () => void; |
|
drain: () => void; |
|
} |
|
type TransportState = "opening" | "open" | "closed" | "pausing" | "paused"; |
|
export declare abstract class Transport extends Emitter<Record<never, never>, Record<never, never>, TransportReservedEvents> { |
|
query: Record<string, string>; |
|
writable: boolean; |
|
protected opts: SocketOptions; |
|
protected supportsBinary: boolean; |
|
protected readyState: TransportState; |
|
protected socket: any; |
|
protected setTimeoutFn: typeof setTimeout; |
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(opts: any); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected onError(reason: string, description: any, context?: any): this; |
|
|
|
|
|
|
|
open(): this; |
|
|
|
|
|
|
|
close(): this; |
|
|
|
|
|
|
|
|
|
|
|
send(packets: any): void; |
|
|
|
|
|
|
|
|
|
|
|
protected onOpen(): void; |
|
|
|
|
|
|
|
|
|
|
|
|
|
protected onData(data: RawData): void; |
|
|
|
|
|
|
|
|
|
|
|
protected onPacket(packet: Packet): void; |
|
|
|
|
|
|
|
|
|
|
|
protected onClose(details?: CloseDetails): void; |
|
|
|
|
|
|
|
abstract get name(): string; |
|
|
|
|
|
|
|
|
|
|
|
pause(onPause: () => void): void; |
|
protected createUri(schema: string, query?: Record<string, unknown>): string; |
|
private _hostname; |
|
private _port; |
|
private _query; |
|
protected abstract doOpen(): any; |
|
protected abstract doClose(): any; |
|
protected abstract write(packets: Packet[]): any; |
|
} |
|
export {}; |
|
|