UNPKG

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