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