UNPKG

1.98 kBTypeScriptView Raw
1import { Channel, PresenceChannel } from './channel';
2/**
3 * This class is the primary API for interacting with broadcasting.
4 */
5export default class Echo {
6 /**
7 * The broadcasting connector.
8 */
9 connector: any;
10 /**
11 * The Echo options.
12 */
13 options: any;
14 /**
15 * Create a new class instance.
16 */
17 constructor(options: any);
18 /**
19 * Get a channel instance by name.
20 */
21 channel(channel: string): Channel;
22 /**
23 * Create a new connection.
24 */
25 connect(): void;
26 /**
27 * Disconnect from the Echo server.
28 */
29 disconnect(): void;
30 /**
31 * Get a presence channel instance by name.
32 */
33 join(channel: string): PresenceChannel;
34 /**
35 * Leave the given channel, as well as its private and presence variants.
36 */
37 leave(channel: string): void;
38 /**
39 * Leave the given channel.
40 */
41 leaveChannel(channel: string): void;
42 /**
43 * Listen for an event on a channel instance.
44 */
45 listen(channel: string, event: string, callback: Function): Channel;
46 /**
47 * Get a private channel instance by name.
48 */
49 private(channel: string): Channel;
50 /**
51 * Get a private encrypted channel instance by name.
52 */
53 encryptedPrivate(channel: string): Channel;
54 /**
55 * Get the Socket ID for the connection.
56 */
57 socketId(): string;
58 /**
59 * Register 3rd party request interceptiors. These are used to automatically
60 * send a connections socket id to a Laravel app with a X-Socket-Id header.
61 */
62 registerInterceptors(): void;
63 /**
64 * Register a Vue HTTP interceptor to add the X-Socket-ID header.
65 */
66 registerVueRequestInterceptor(): void;
67 /**
68 * Register an Axios HTTP interceptor to add the X-Socket-ID header.
69 */
70 registerAxiosRequestInterceptor(): void;
71 /**
72 * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
73 */
74 registerjQueryAjaxSetup(): void;
75}