UNPKG

1.62 kBTypeScriptView Raw
1import type { IncomingHttpHeaders } from "http";
2import type { ParsedUrlQuery } from "querystring";
3export type DisconnectReason = "transport error" | "transport close" | "forced close" | "ping timeout" | "parse error" | "server shutting down" | "forced server close" | "client namespace disconnect" | "server namespace disconnect";
4export interface SocketReservedEventsMap {
5 disconnect: (reason: DisconnectReason, description?: any) => void;
6 disconnecting: (reason: DisconnectReason, description?: any) => void;
7 error: (err: Error) => void;
8}
9export interface EventEmitterReservedEventsMap {
10 newListener: (eventName: string | Symbol, listener: (...args: any[]) => void) => void;
11 removeListener: (eventName: string | Symbol, listener: (...args: any[]) => void) => void;
12}
13export declare const RESERVED_EVENTS: ReadonlySet<string | Symbol>;
14/**
15 * The handshake details
16 */
17export interface Handshake {
18 /**
19 * The headers sent as part of the handshake
20 */
21 headers: IncomingHttpHeaders;
22 /**
23 * The date of creation (as string)
24 */
25 time: string;
26 /**
27 * The ip of the client
28 */
29 address: string;
30 /**
31 * Whether the connection is cross-domain
32 */
33 xdomain: boolean;
34 /**
35 * Whether the connection is secure
36 */
37 secure: boolean;
38 /**
39 * The date of creation (as unix timestamp)
40 */
41 issued: number;
42 /**
43 * The request URL string
44 */
45 url: string;
46 /**
47 * The query object
48 */
49 query: ParsedUrlQuery;
50 /**
51 * The auth object
52 */
53 auth: {
54 [key: string]: any;
55 };
56}