UNPKG

1.46 kBTypeScriptView Raw
1import { Channel, PresenceChannel } from '../channel';
2export declare abstract class Connector<TPublic extends Channel, TPrivate extends Channel, TPresence extends PresenceChannel> {
3 /**
4 * Default connector options.
5 */
6 private _defaultOptions;
7 /**
8 * Connector options.
9 */
10 options: any;
11 /**
12 * Create a new class instance.
13 */
14 constructor(options: any);
15 /**
16 * Merge the custom options with the defaults.
17 */
18 protected setOptions(options: any): any;
19 /**
20 * Extract the CSRF token from the page.
21 */
22 protected csrfToken(): null | string;
23 /**
24 * Create a fresh connection.
25 */
26 abstract connect(): void;
27 /**
28 * Get a channel instance by name.
29 */
30 abstract channel(channel: string): TPublic;
31 /**
32 * Get a private channel instance by name.
33 */
34 abstract privateChannel(channel: string): TPrivate;
35 /**
36 * Get a presence channel instance by name.
37 */
38 abstract presenceChannel(channel: string): TPresence;
39 /**
40 * Leave the given channel, as well as its private and presence variants.
41 */
42 abstract leave(channel: string): void;
43 /**
44 * Leave the given channel.
45 */
46 abstract leaveChannel(channel: string): void;
47 /**
48 * Get the socket_id of the connection.
49 */
50 abstract socketId(): string;
51 /**
52 * Disconnect from the Echo server.
53 */
54 abstract disconnect(): void;
55}