UNPKG

1.51 kBTypeScriptView Raw
1import { Connector } from './connector';
2import { SocketIoChannel, SocketIoPrivateChannel, SocketIoPresenceChannel } from './../channel';
3/**
4 * This class creates a connnector to a Socket.io server.
5 */
6export declare class SocketIoConnector extends Connector {
7 /**
8 * The Socket.io connection instance.
9 */
10 socket: any;
11 /**
12 * All of the subscribed channel names.
13 */
14 channels: {
15 [name: string]: SocketIoChannel;
16 };
17 /**
18 * Create a fresh Socket.io connection.
19 */
20 connect(): void;
21 /**
22 * Get socket.io module from global scope or options.
23 */
24 getSocketIO(): any;
25 /**
26 * Listen for an event on a channel instance.
27 */
28 listen(name: string, event: string, callback: Function): SocketIoChannel;
29 /**
30 * Get a channel instance by name.
31 */
32 channel(name: string): SocketIoChannel;
33 /**
34 * Get a private channel instance by name.
35 */
36 privateChannel(name: string): SocketIoPrivateChannel;
37 /**
38 * Get a presence channel instance by name.
39 */
40 presenceChannel(name: string): SocketIoPresenceChannel;
41 /**
42 * Leave the given channel, as well as its private and presence variants.
43 */
44 leave(name: string): void;
45 /**
46 * Leave the given channel.
47 */
48 leaveChannel(name: string): void;
49 /**
50 * Get the socket ID for the connection.
51 */
52 socketId(): string;
53 /**
54 * Disconnect Socketio connection.
55 */
56 disconnect(): void;
57}