source: trip-planner-front/node_modules/socket.io-adapter/dist/es/index.d.ts@ 571e0df

Last change on this file since 571e0df was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/// <reference types="node" />
2import { EventEmitter } from "events";
3export declare type SocketId = string;
4export declare type Room = string;
5export interface BroadcastFlags {
6 volatile?: boolean;
7 compress?: boolean;
8 local?: boolean;
9 broadcast?: boolean;
10 binary?: boolean;
11}
12export interface BroadcastOptions {
13 rooms: Set<Room>;
14 except?: Set<SocketId>;
15 flags?: BroadcastFlags;
16}
17export declare class Adapter extends EventEmitter {
18 readonly nsp: any;
19 rooms: Map<Room, Set<SocketId>>;
20 sids: Map<SocketId, Set<Room>>;
21 private readonly encoder;
22 /**
23 * In-memory adapter constructor.
24 *
25 * @param {Namespace} nsp
26 */
27 constructor(nsp: any);
28 /**
29 * To be overridden
30 */
31 init(): Promise<void> | void;
32 /**
33 * To be overridden
34 */
35 close(): Promise<void> | void;
36 /**
37 * Adds a socket to a list of room.
38 *
39 * @param {SocketId} id the socket id
40 * @param {Set<Room>} rooms a set of rooms
41 * @public
42 */
43 addAll(id: SocketId, rooms: Set<Room>): Promise<void> | void;
44 /**
45 * Removes a socket from a room.
46 *
47 * @param {SocketId} id the socket id
48 * @param {Room} room the room name
49 */
50 del(id: SocketId, room: Room): Promise<void> | void;
51 private _del;
52 /**
53 * Removes a socket from all rooms it's joined.
54 *
55 * @param {SocketId} id the socket id
56 */
57 delAll(id: SocketId): void;
58 /**
59 * Broadcasts a packet.
60 *
61 * Options:
62 * - `flags` {Object} flags for this packet
63 * - `except` {Array} sids that should be excluded
64 * - `rooms` {Array} list of rooms to broadcast to
65 *
66 * @param {Object} packet the packet object
67 * @param {Object} opts the options
68 * @public
69 */
70 broadcast(packet: any, opts: BroadcastOptions): void;
71 /**
72 * Gets a list of sockets by sid.
73 *
74 * @param {Set<Room>} rooms the explicit set of rooms to check.
75 */
76 sockets(rooms: Set<Room>): Promise<Set<SocketId>>;
77 /**
78 * Gets the list of rooms a given socket has joined.
79 *
80 * @param {SocketId} id the socket id
81 */
82 socketRooms(id: SocketId): Set<Room> | undefined;
83 /**
84 * Returns the matching socket instances
85 *
86 * @param opts - the filters to apply
87 */
88 fetchSockets(opts: BroadcastOptions): Promise<any[]>;
89 /**
90 * Makes the matching socket instances join the specified rooms
91 *
92 * @param opts - the filters to apply
93 * @param rooms - the rooms to join
94 */
95 addSockets(opts: BroadcastOptions, rooms: Room[]): void;
96 /**
97 * Makes the matching socket instances leave the specified rooms
98 *
99 * @param opts - the filters to apply
100 * @param rooms - the rooms to leave
101 */
102 delSockets(opts: BroadcastOptions, rooms: Room[]): void;
103 /**
104 * Makes the matching socket instances disconnect
105 *
106 * @param opts - the filters to apply
107 * @param close - whether to close the underlying connection
108 */
109 disconnectSockets(opts: BroadcastOptions, close: boolean): void;
110 private apply;
111 private computeExceptSids;
112 /**
113 * Send a packet to the other Socket.IO servers in the cluster
114 * @param packet - an array of arguments, which may include an acknowledgement callback at the end
115 */
116 serverSideEmit(packet: any[]): void;
117}
Note: See TracBrowser for help on using the repository browser.