client.d.ts
2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/// <reference types="node" />
import { Packet } from "socket.io-parser";
import type { IncomingMessage } from "http";
import type { Server } from "./index";
import type { EventsMap } from "./typed-events";
import type { Socket } from "./socket";
import type { Socket as RawSocket } from "engine.io";
interface WriteOptions {
compress?: boolean;
volatile?: boolean;
preEncoded?: boolean;
wsPreEncoded?: string;
}
export declare class Client<ListenEvents extends EventsMap, EmitEvents extends EventsMap, ServerSideEvents extends EventsMap, SocketData = any> {
readonly conn: RawSocket;
private readonly id;
private readonly server;
private readonly encoder;
private readonly decoder;
private sockets;
private nsps;
private connectTimeout?;
/**
* Client constructor.
*
* @param server instance
* @param conn
* @package
*/
constructor(server: Server<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, conn: any);
/**
* @return the reference to the request that originated the Engine.IO connection
*
* @public
*/
get request(): IncomingMessage;
/**
* Sets up event listeners.
*
* @private
*/
private setup;
/**
* Connects a client to a namespace.
*
* @param {String} name - the namespace
* @param {Object} auth - the auth parameters
* @private
*/
private connect;
/**
* Connects a client to a namespace.
*
* @param name - the namespace
* @param {Object} auth - the auth parameters
*
* @private
*/
private doConnect;
/**
* Disconnects from all namespaces and closes transport.
*
* @private
*/
_disconnect(): void;
/**
* Removes a socket. Called by each `Socket`.
*
* @private
*/
_remove(socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>): void;
/**
* Closes the underlying connection.
*
* @private
*/
private close;
/**
* Writes a packet to the transport.
*
* @param {Object} packet object
* @param {Object} opts
* @private
*/
_packet(packet: Packet | any[], opts?: WriteOptions): void;
private writeToEngine;
/**
* Called with incoming transport data.
*
* @private
*/
private ondata;
/**
* Called when parser fully decodes a packet.
*
* @private
*/
private ondecoded;
/**
* Handles an error.
*
* @param {Object} err object
* @private
*/
private onerror;
/**
* Called upon transport close.
*
* @param reason
* @private
*/
private onclose;
/**
* Cleans up event listeners.
* @private
*/
private destroy;
}
export {};