@eleven-am/pondsocket 0.1.116 → 0.1.119
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/channel/eventResponse.js +11 -1
- package/nest.js +6 -1
- package/package.json +1 -1
- package/types.d.ts +10 -1
package/channel/eventResponse.js
CHANGED
|
@@ -58,7 +58,7 @@ class EventResponse extends abstractResponse_1.PondResponse {
|
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* @desc Emits a direct message to the client
|
|
61
|
+
* @desc Emits a direct message to the client, accepting the request
|
|
62
62
|
* @param event - the event name
|
|
63
63
|
* @param payload - the payload to send
|
|
64
64
|
* @param assigns - the data to assign to the client
|
|
@@ -67,6 +67,16 @@ class EventResponse extends abstractResponse_1.PondResponse {
|
|
|
67
67
|
this.accept(assigns);
|
|
68
68
|
__classPrivateFieldGet(this, _EventResponse_engine, "f").sendMessage(enums_1.SystemSender.CHANNEL, [__classPrivateFieldGet(this, _EventResponse_event, "f").sender], enums_1.ServerActions.SYSTEM, event, payload);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @desc Emits a direct message to the client without accepting the request
|
|
72
|
+
* @param event - the event name
|
|
73
|
+
* @param payload - the payload to send
|
|
74
|
+
* @param assigns - the data to assign to the client
|
|
75
|
+
*/
|
|
76
|
+
sendOnly(event, payload, assigns) {
|
|
77
|
+
__classPrivateFieldGet(this, _EventResponse_instances, "m", _EventResponse_manageAssigns).call(this, assigns);
|
|
78
|
+
__classPrivateFieldGet(this, _EventResponse_engine, "f").sendMessage(enums_1.SystemSender.CHANNEL, [__classPrivateFieldGet(this, _EventResponse_event, "f").sender], enums_1.ServerActions.SYSTEM, event, payload);
|
|
79
|
+
}
|
|
70
80
|
/**
|
|
71
81
|
* @desc Sends a message to all clients in the channel
|
|
72
82
|
* @param event - the event to send
|
package/nest.js
CHANGED
|
@@ -270,7 +270,12 @@ function manageResponse(data, channel, response) {
|
|
|
270
270
|
const { event, presence, updatePresence, assigns, broadcast } = data, rest = __rest(data, ["event", "presence", "updatePresence", "assigns", "broadcast"]);
|
|
271
271
|
if (response) {
|
|
272
272
|
if (event && typeof event === 'string' && isNotEmpty(rest)) {
|
|
273
|
-
response
|
|
273
|
+
if (response instanceof eventResponse_1.EventResponse) {
|
|
274
|
+
response.sendOnly(event, rest, assigns);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
response.send(event, rest, assigns);
|
|
278
|
+
}
|
|
274
279
|
}
|
|
275
280
|
else if (isNotEmpty(assigns)) {
|
|
276
281
|
response.accept(assigns);
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -266,13 +266,22 @@ declare class EventResponse extends PondResponse {
|
|
|
266
266
|
reject (message?: string, errorCode?: number, assigns?: PondAssigns): EventResponse;
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
|
-
* @desc Emits a direct message to the client
|
|
269
|
+
* @desc Emits a direct message to the client, accepting the request
|
|
270
270
|
* @param event - the event name
|
|
271
271
|
* @param payload - the payload to send
|
|
272
272
|
* @param assigns - the data to assign to the client
|
|
273
273
|
*/
|
|
274
274
|
send (event: string, payload: PondMessage, assigns?: PondAssigns): void;
|
|
275
275
|
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @desc Emits a direct message to the client without accepting the request
|
|
279
|
+
* @param event - the event name
|
|
280
|
+
* @param payload - the payload to send
|
|
281
|
+
* @param assigns - the data to assign to the client
|
|
282
|
+
*/
|
|
283
|
+
sendOnly (event: string, payload: PondMessage, assigns?: PondAssigns): void;
|
|
284
|
+
|
|
276
285
|
/**
|
|
277
286
|
* @desc Sends a message to all clients in the channel
|
|
278
287
|
* @param event - the event to send
|