source: trip-planner-front/node_modules/socket.io/dist/broadcast-operator.d.ts@ e29cc2e

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

primeNG components

  • Property mode set to 100644
File size: 4.2 KB
Line 
1import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
2import { Handshake } from "./socket";
3import type { Adapter } from "socket.io-adapter";
4import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
5export declare class BroadcastOperator<EmitEvents extends EventsMap> implements TypedEventBroadcaster<EmitEvents> {
6 private readonly adapter;
7 private readonly rooms;
8 private readonly exceptRooms;
9 private readonly flags;
10 constructor(adapter: Adapter, rooms?: Set<Room>, exceptRooms?: Set<Room>, flags?: BroadcastFlags);
11 /**
12 * Targets a room when emitting.
13 *
14 * @param room
15 * @return a new BroadcastOperator instance
16 * @public
17 */
18 to(room: Room | Room[]): BroadcastOperator<EmitEvents>;
19 /**
20 * Targets a room when emitting.
21 *
22 * @param room
23 * @return a new BroadcastOperator instance
24 * @public
25 */
26 in(room: Room | Room[]): BroadcastOperator<EmitEvents>;
27 /**
28 * Excludes a room when emitting.
29 *
30 * @param room
31 * @return a new BroadcastOperator instance
32 * @public
33 */
34 except(room: Room | Room[]): BroadcastOperator<EmitEvents>;
35 /**
36 * Sets the compress flag.
37 *
38 * @param compress - if `true`, compresses the sending data
39 * @return a new BroadcastOperator instance
40 * @public
41 */
42 compress(compress: boolean): BroadcastOperator<EmitEvents>;
43 /**
44 * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
45 * receive messages (because of network slowness or other issues, or because they’re connected through long polling
46 * and is in the middle of a request-response cycle).
47 *
48 * @return a new BroadcastOperator instance
49 * @public
50 */
51 get volatile(): BroadcastOperator<EmitEvents>;
52 /**
53 * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
54 *
55 * @return a new BroadcastOperator instance
56 * @public
57 */
58 get local(): BroadcastOperator<EmitEvents>;
59 /**
60 * Emits to all clients.
61 *
62 * @return Always true
63 * @public
64 */
65 emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): boolean;
66 /**
67 * Gets a list of clients.
68 *
69 * @public
70 */
71 allSockets(): Promise<Set<SocketId>>;
72 /**
73 * Returns the matching socket instances
74 *
75 * @public
76 */
77 fetchSockets(): Promise<RemoteSocket<EmitEvents>[]>;
78 /**
79 * Makes the matching socket instances join the specified rooms
80 *
81 * @param room
82 * @public
83 */
84 socketsJoin(room: Room | Room[]): void;
85 /**
86 * Makes the matching socket instances leave the specified rooms
87 *
88 * @param room
89 * @public
90 */
91 socketsLeave(room: Room | Room[]): void;
92 /**
93 * Makes the matching socket instances disconnect
94 *
95 * @param close - whether to close the underlying connection
96 * @public
97 */
98 disconnectSockets(close?: boolean): void;
99}
100/**
101 * Format of the data when the Socket instance exists on another Socket.IO server
102 */
103interface SocketDetails {
104 id: SocketId;
105 handshake: Handshake;
106 rooms: Room[];
107 data: any;
108}
109/**
110 * Expose of subset of the attributes and methods of the Socket class
111 */
112export declare class RemoteSocket<EmitEvents extends EventsMap> implements TypedEventBroadcaster<EmitEvents> {
113 readonly id: SocketId;
114 readonly handshake: Handshake;
115 readonly rooms: Set<Room>;
116 readonly data: any;
117 private readonly operator;
118 constructor(adapter: Adapter, details: SocketDetails);
119 emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): boolean;
120 /**
121 * Joins a room.
122 *
123 * @param {String|Array} room - room or array of rooms
124 * @public
125 */
126 join(room: Room | Room[]): void;
127 /**
128 * Leaves a room.
129 *
130 * @param {String} room
131 * @public
132 */
133 leave(room: Room): void;
134 /**
135 * Disconnects this client.
136 *
137 * @param {Boolean} close - if `true`, closes the underlying connection
138 * @return {Socket} self
139 *
140 * @public
141 */
142 disconnect(close?: boolean): this;
143}
144export {};
Note: See TracBrowser for help on using the repository browser.