@sebspark/socket.io-gcp-pubsub-emitter 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -35
- package/package.json +9 -9
- package/dist/index.d.mts +0 -160
- package/dist/index.mjs +0 -248
package/dist/index.js
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
Emitter: () => Emitter
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
|
|
27
1
|
// src/operator.ts
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
import { randomBytes } from "crypto";
|
|
3
|
+
import { encode } from "@msgpack/msgpack";
|
|
4
|
+
import { MessageType } from "socket.io-adapter";
|
|
31
5
|
|
|
32
6
|
// src/types.ts
|
|
33
7
|
var RESERVED_EVENTS = /* @__PURE__ */ new Set([
|
|
@@ -58,7 +32,7 @@ var BroadcastOperator = class _BroadcastOperator {
|
|
|
58
32
|
if (RESERVED_EVENTS.has(ev)) {
|
|
59
33
|
throw new Error(`"${ev}" is a reserved event name`);
|
|
60
34
|
}
|
|
61
|
-
const uid =
|
|
35
|
+
const uid = randomBytes(8).toString("hex");
|
|
62
36
|
const nsp = this.broadcastOptions.nsp;
|
|
63
37
|
const data = [ev, ...args];
|
|
64
38
|
const packet = {
|
|
@@ -74,7 +48,7 @@ var BroadcastOperator = class _BroadcastOperator {
|
|
|
74
48
|
const clusterMessage = {
|
|
75
49
|
nsp,
|
|
76
50
|
uid,
|
|
77
|
-
type:
|
|
51
|
+
type: MessageType.BROADCAST,
|
|
78
52
|
data: {
|
|
79
53
|
packet,
|
|
80
54
|
opts
|
|
@@ -82,7 +56,7 @@ var BroadcastOperator = class _BroadcastOperator {
|
|
|
82
56
|
};
|
|
83
57
|
const message = {
|
|
84
58
|
attributes: { nsp, uid },
|
|
85
|
-
data:
|
|
59
|
+
data: encode(clusterMessage)
|
|
86
60
|
};
|
|
87
61
|
this.topic.publishMessage(message);
|
|
88
62
|
return true;
|
|
@@ -269,7 +243,6 @@ var Emitter = class _Emitter {
|
|
|
269
243
|
);
|
|
270
244
|
}
|
|
271
245
|
};
|
|
272
|
-
|
|
273
|
-
0 && (module.exports = {
|
|
246
|
+
export {
|
|
274
247
|
Emitter
|
|
275
|
-
}
|
|
248
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/socket.io-gcp-pubsub-emitter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
10
|
"dist"
|
|
10
11
|
],
|
|
11
12
|
"scripts": {
|
|
12
|
-
"build": "tsup-node src/index.ts --format esm
|
|
13
|
+
"build": "tsup-node src/index.ts --format esm --target node22 --dts",
|
|
13
14
|
"dev": "tsc --watch --noEmit",
|
|
14
15
|
"lint": "biome check .",
|
|
15
16
|
"test": "vitest run --passWithNoTests --coverage",
|
|
@@ -17,20 +18,19 @@
|
|
|
17
18
|
"typecheck": "vitest --typecheck.only --passWithNoTests"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
21
|
+
"@sebspark/tsconfig": "*",
|
|
20
22
|
"@socket.io/gcp-pubsub-adapter": "0.1.0",
|
|
21
23
|
"@testcontainers/gcloud": "11.7.2",
|
|
22
24
|
"find-free-ports": "3.1.1",
|
|
23
25
|
"socket.io": "4.8.1",
|
|
24
|
-
"socket.io-client": "4.8.1"
|
|
25
|
-
"testcontainers": "11.7.2",
|
|
26
|
-
"tsconfig": "*"
|
|
26
|
+
"socket.io-client": "4.8.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@google-cloud/pubsub": "
|
|
30
|
-
"@msgpack/msgpack": "
|
|
31
|
-
"socket.io-adapter": "
|
|
29
|
+
"@google-cloud/pubsub": "5.2.0",
|
|
30
|
+
"@msgpack/msgpack": "3.1.2",
|
|
31
|
+
"socket.io-adapter": "2.5.5"
|
|
32
32
|
},
|
|
33
33
|
"resolutions": {
|
|
34
|
-
"@google-cloud/pubsub": "
|
|
34
|
+
"@google-cloud/pubsub": "5.2.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Topic } from '@google-cloud/pubsub';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* An events map is an interface that maps event names to their value, which
|
|
5
|
-
* represents the type of the `on` listener.
|
|
6
|
-
*/
|
|
7
|
-
interface EventsMap {
|
|
8
|
-
[event: string]: any;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The default events map, used if no EventsMap is given. Using this EventsMap
|
|
12
|
-
* is equivalent to accepting all event names, and any data.
|
|
13
|
-
*/
|
|
14
|
-
interface DefaultEventsMap {
|
|
15
|
-
[event: string]: (...args: unknown[]) => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Returns a union type containing all the keys of an event map.
|
|
19
|
-
*/
|
|
20
|
-
type EventNames<Map extends EventsMap> = keyof Map & (string | symbol);
|
|
21
|
-
/** The tuple type representing the parameters of an event listener */
|
|
22
|
-
type EventParams<Map extends EventsMap, Ev extends EventNames<Map>> = Parameters<Map[Ev]>;
|
|
23
|
-
/**
|
|
24
|
-
* Interface for classes that aren't `EventEmitter`s, but still expose a
|
|
25
|
-
* strictly typed `emit` method.
|
|
26
|
-
*/
|
|
27
|
-
interface TypedEventBroadcaster<EmitEvents extends EventsMap> {
|
|
28
|
-
emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type EmitterOptions = unknown;
|
|
32
|
-
interface BroadcastOptions {
|
|
33
|
-
nsp: string;
|
|
34
|
-
}
|
|
35
|
-
interface BroadcastFlags {
|
|
36
|
-
volatile?: boolean;
|
|
37
|
-
compress?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class BroadcastOperator<EmitEvents extends EventsMap> implements TypedEventBroadcaster<EmitEvents> {
|
|
41
|
-
private readonly topic;
|
|
42
|
-
private readonly broadcastOptions;
|
|
43
|
-
private readonly rooms;
|
|
44
|
-
private readonly exceptRooms;
|
|
45
|
-
private readonly flags;
|
|
46
|
-
constructor(topic: Topic, broadcastOptions: BroadcastOptions, rooms?: Set<string>, exceptRooms?: Set<string>, flags?: BroadcastFlags);
|
|
47
|
-
/**
|
|
48
|
-
* Emits to all clients.
|
|
49
|
-
*
|
|
50
|
-
* @return Always true
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): true;
|
|
54
|
-
/**
|
|
55
|
-
* Targets a room when emitting.
|
|
56
|
-
*
|
|
57
|
-
* @param room
|
|
58
|
-
* @return a new BroadcastOperator instance
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
to(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
62
|
-
/**
|
|
63
|
-
* Targets a room when emitting.
|
|
64
|
-
*
|
|
65
|
-
* @param room
|
|
66
|
-
* @return a new BroadcastOperator instance
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
in(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
70
|
-
/**
|
|
71
|
-
* Excludes a room when emitting.
|
|
72
|
-
*
|
|
73
|
-
* @param room
|
|
74
|
-
* @return a new BroadcastOperator instance
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
except(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
78
|
-
/**
|
|
79
|
-
* Sets the compress flag.
|
|
80
|
-
*
|
|
81
|
-
* @param compress - if `true`, compresses the sending data
|
|
82
|
-
* @return a new BroadcastOperator instance
|
|
83
|
-
* @public
|
|
84
|
-
*/
|
|
85
|
-
compress(compress: boolean): BroadcastOperator<EmitEvents>;
|
|
86
|
-
/**
|
|
87
|
-
* Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
|
|
88
|
-
* receive messages (because of network slowness or other issues, or because they’re connected through long polling
|
|
89
|
-
* and is in the middle of a request-response cycle).
|
|
90
|
-
*
|
|
91
|
-
* @return a new BroadcastOperator instance
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
|
-
get volatile(): BroadcastOperator<EmitEvents>;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
declare class Emitter<EmitEvents extends EventsMap = DefaultEventsMap> {
|
|
98
|
-
readonly topic: Topic;
|
|
99
|
-
readonly nsp: string;
|
|
100
|
-
private readonly opts;
|
|
101
|
-
private readonly broadcastOptions;
|
|
102
|
-
constructor(topic: Topic, opts?: EmitterOptions, nsp?: string);
|
|
103
|
-
/**
|
|
104
|
-
* Emits to all clients.
|
|
105
|
-
*
|
|
106
|
-
* @return Always true
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): true;
|
|
110
|
-
/**
|
|
111
|
-
* Return a new emitter for the given namespace.
|
|
112
|
-
*
|
|
113
|
-
* @param nsp - namespace
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
of(nsp: string): Emitter<EmitEvents>;
|
|
117
|
-
/**
|
|
118
|
-
* Targets a room when emitting.
|
|
119
|
-
*
|
|
120
|
-
* @param room
|
|
121
|
-
* @return BroadcastOperator
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
to(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
125
|
-
/**
|
|
126
|
-
* Targets a room when emitting.
|
|
127
|
-
*
|
|
128
|
-
* @param room
|
|
129
|
-
* @return BroadcastOperator
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
in(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
133
|
-
/**
|
|
134
|
-
* Excludes a room when emitting.
|
|
135
|
-
*
|
|
136
|
-
* @param room
|
|
137
|
-
* @return BroadcastOperator
|
|
138
|
-
* @public
|
|
139
|
-
*/
|
|
140
|
-
except(room: string | string[]): BroadcastOperator<EmitEvents>;
|
|
141
|
-
/**
|
|
142
|
-
* Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
|
|
143
|
-
* receive messages (because of network slowness or other issues, or because they’re connected through long polling
|
|
144
|
-
* and is in the middle of a request-response cycle).
|
|
145
|
-
*
|
|
146
|
-
* @return BroadcastOperator
|
|
147
|
-
* @public
|
|
148
|
-
*/
|
|
149
|
-
get volatile(): BroadcastOperator<EmitEvents>;
|
|
150
|
-
/**
|
|
151
|
-
* Sets the compress flag.
|
|
152
|
-
*
|
|
153
|
-
* @param compress - if `true`, compresses the sending data
|
|
154
|
-
* @return BroadcastOperator
|
|
155
|
-
* @public
|
|
156
|
-
*/
|
|
157
|
-
compress(compress: boolean): BroadcastOperator<EmitEvents>;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export { Emitter };
|
package/dist/index.mjs
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
// src/operator.ts
|
|
2
|
-
import { randomBytes } from "crypto";
|
|
3
|
-
import { encode } from "@msgpack/msgpack";
|
|
4
|
-
import { MessageType } from "socket.io-adapter";
|
|
5
|
-
|
|
6
|
-
// src/types.ts
|
|
7
|
-
var RESERVED_EVENTS = /* @__PURE__ */ new Set([
|
|
8
|
-
"connect",
|
|
9
|
-
"connect_error",
|
|
10
|
-
"disconnect",
|
|
11
|
-
"disconnecting",
|
|
12
|
-
"newListener",
|
|
13
|
-
"removeListener"
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
// src/operator.ts
|
|
17
|
-
var BroadcastOperator = class _BroadcastOperator {
|
|
18
|
-
constructor(topic, broadcastOptions, rooms = /* @__PURE__ */ new Set(), exceptRooms = /* @__PURE__ */ new Set(), flags = {}) {
|
|
19
|
-
this.topic = topic;
|
|
20
|
-
this.broadcastOptions = broadcastOptions;
|
|
21
|
-
this.rooms = rooms;
|
|
22
|
-
this.exceptRooms = exceptRooms;
|
|
23
|
-
this.flags = flags;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Emits to all clients.
|
|
27
|
-
*
|
|
28
|
-
* @return Always true
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
emit(ev, ...args) {
|
|
32
|
-
if (RESERVED_EVENTS.has(ev)) {
|
|
33
|
-
throw new Error(`"${ev}" is a reserved event name`);
|
|
34
|
-
}
|
|
35
|
-
const uid = randomBytes(8).toString("hex");
|
|
36
|
-
const nsp = this.broadcastOptions.nsp;
|
|
37
|
-
const data = [ev, ...args];
|
|
38
|
-
const packet = {
|
|
39
|
-
type: 2 /* EVENT */,
|
|
40
|
-
data,
|
|
41
|
-
nsp
|
|
42
|
-
};
|
|
43
|
-
const opts = {
|
|
44
|
-
rooms: [...this.rooms],
|
|
45
|
-
flags: this.flags,
|
|
46
|
-
except: [...this.exceptRooms]
|
|
47
|
-
};
|
|
48
|
-
const clusterMessage = {
|
|
49
|
-
nsp,
|
|
50
|
-
uid,
|
|
51
|
-
type: MessageType.BROADCAST,
|
|
52
|
-
data: {
|
|
53
|
-
packet,
|
|
54
|
-
opts
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const message = {
|
|
58
|
-
attributes: { nsp, uid },
|
|
59
|
-
data: encode(clusterMessage)
|
|
60
|
-
};
|
|
61
|
-
this.topic.publishMessage(message);
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Targets a room when emitting.
|
|
66
|
-
*
|
|
67
|
-
* @param room
|
|
68
|
-
* @return a new BroadcastOperator instance
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
to(room) {
|
|
72
|
-
const rooms = new Set(this.rooms);
|
|
73
|
-
if (Array.isArray(room)) {
|
|
74
|
-
for (const r of room) {
|
|
75
|
-
rooms.add(r);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
rooms.add(room);
|
|
79
|
-
}
|
|
80
|
-
return new _BroadcastOperator(
|
|
81
|
-
this.topic,
|
|
82
|
-
this.broadcastOptions,
|
|
83
|
-
rooms,
|
|
84
|
-
this.exceptRooms,
|
|
85
|
-
this.flags
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Targets a room when emitting.
|
|
90
|
-
*
|
|
91
|
-
* @param room
|
|
92
|
-
* @return a new BroadcastOperator instance
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
in(room) {
|
|
96
|
-
return this.to(room);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Excludes a room when emitting.
|
|
100
|
-
*
|
|
101
|
-
* @param room
|
|
102
|
-
* @return a new BroadcastOperator instance
|
|
103
|
-
* @public
|
|
104
|
-
*/
|
|
105
|
-
except(room) {
|
|
106
|
-
const exceptRooms = new Set(this.exceptRooms);
|
|
107
|
-
if (Array.isArray(room)) {
|
|
108
|
-
for (const r of room) {
|
|
109
|
-
exceptRooms.add(r);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
exceptRooms.add(room);
|
|
113
|
-
}
|
|
114
|
-
return new _BroadcastOperator(
|
|
115
|
-
this.topic,
|
|
116
|
-
this.broadcastOptions,
|
|
117
|
-
this.rooms,
|
|
118
|
-
exceptRooms,
|
|
119
|
-
this.flags
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Sets the compress flag.
|
|
124
|
-
*
|
|
125
|
-
* @param compress - if `true`, compresses the sending data
|
|
126
|
-
* @return a new BroadcastOperator instance
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
129
|
-
compress(compress) {
|
|
130
|
-
const flags = Object.assign({}, this.flags, { compress });
|
|
131
|
-
return new _BroadcastOperator(
|
|
132
|
-
this.topic,
|
|
133
|
-
this.broadcastOptions,
|
|
134
|
-
this.rooms,
|
|
135
|
-
this.exceptRooms,
|
|
136
|
-
flags
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
|
|
141
|
-
* receive messages (because of network slowness or other issues, or because they’re connected through long polling
|
|
142
|
-
* and is in the middle of a request-response cycle).
|
|
143
|
-
*
|
|
144
|
-
* @return a new BroadcastOperator instance
|
|
145
|
-
* @public
|
|
146
|
-
*/
|
|
147
|
-
get volatile() {
|
|
148
|
-
const flags = Object.assign({}, this.flags, { volatile: true });
|
|
149
|
-
return new _BroadcastOperator(
|
|
150
|
-
this.topic,
|
|
151
|
-
this.broadcastOptions,
|
|
152
|
-
this.rooms,
|
|
153
|
-
this.exceptRooms,
|
|
154
|
-
flags
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// src/emitter.ts
|
|
160
|
-
var Emitter = class _Emitter {
|
|
161
|
-
constructor(topic, opts, nsp = "/") {
|
|
162
|
-
this.topic = topic;
|
|
163
|
-
this.nsp = nsp;
|
|
164
|
-
this.opts = opts || {};
|
|
165
|
-
this.broadcastOptions = {
|
|
166
|
-
nsp
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
opts;
|
|
170
|
-
broadcastOptions;
|
|
171
|
-
/**
|
|
172
|
-
* Emits to all clients.
|
|
173
|
-
*
|
|
174
|
-
* @return Always true
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
emit(ev, ...args) {
|
|
178
|
-
return new BroadcastOperator(
|
|
179
|
-
this.topic,
|
|
180
|
-
this.broadcastOptions
|
|
181
|
-
).emit(ev, ...args);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Return a new emitter for the given namespace.
|
|
185
|
-
*
|
|
186
|
-
* @param nsp - namespace
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
of(nsp) {
|
|
190
|
-
return new _Emitter(this.topic, this.opts, (nsp[0] !== "/" ? "/" : "") + nsp);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Targets a room when emitting.
|
|
194
|
-
*
|
|
195
|
-
* @param room
|
|
196
|
-
* @return BroadcastOperator
|
|
197
|
-
* @public
|
|
198
|
-
*/
|
|
199
|
-
to(room) {
|
|
200
|
-
return new BroadcastOperator(this.topic, this.broadcastOptions).to(room);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Targets a room when emitting.
|
|
204
|
-
*
|
|
205
|
-
* @param room
|
|
206
|
-
* @return BroadcastOperator
|
|
207
|
-
* @public
|
|
208
|
-
*/
|
|
209
|
-
in(room) {
|
|
210
|
-
return new BroadcastOperator(this.topic, this.broadcastOptions).in(room);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Excludes a room when emitting.
|
|
214
|
-
*
|
|
215
|
-
* @param room
|
|
216
|
-
* @return BroadcastOperator
|
|
217
|
-
* @public
|
|
218
|
-
*/
|
|
219
|
-
except(room) {
|
|
220
|
-
return new BroadcastOperator(this.topic, this.broadcastOptions).except(room);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
|
|
224
|
-
* receive messages (because of network slowness or other issues, or because they’re connected through long polling
|
|
225
|
-
* and is in the middle of a request-response cycle).
|
|
226
|
-
*
|
|
227
|
-
* @return BroadcastOperator
|
|
228
|
-
* @public
|
|
229
|
-
*/
|
|
230
|
-
get volatile() {
|
|
231
|
-
return new BroadcastOperator(this.topic, this.broadcastOptions).volatile;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Sets the compress flag.
|
|
235
|
-
*
|
|
236
|
-
* @param compress - if `true`, compresses the sending data
|
|
237
|
-
* @return BroadcastOperator
|
|
238
|
-
* @public
|
|
239
|
-
*/
|
|
240
|
-
compress(compress) {
|
|
241
|
-
return new BroadcastOperator(this.topic, this.broadcastOptions).compress(
|
|
242
|
-
compress
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
export {
|
|
247
|
-
Emitter
|
|
248
|
-
};
|