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