@eleven-am/pondsocket 0.1.38 → 0.1.39
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/package.json
CHANGED
|
@@ -127,6 +127,12 @@ class EventResponse extends abstractResponse_1.PondResponse {
|
|
|
127
127
|
this._engine.destroy(reason);
|
|
128
128
|
this._hasExecuted = true;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* @desc Resolves the request as sent with no further action
|
|
132
|
+
*/
|
|
133
|
+
end() {
|
|
134
|
+
this._hasExecuted = true;
|
|
135
|
+
}
|
|
130
136
|
/**
|
|
131
137
|
* @desc Gets the event that triggered the response
|
|
132
138
|
* @param assigns - the data to assign to the client
|
|
@@ -29,8 +29,12 @@ class ConnectionResponse extends abstractResponse_1.PondResponse {
|
|
|
29
29
|
throw new Error('EndpointResponse: Message has already been processed');
|
|
30
30
|
}
|
|
31
31
|
this._hasExecuted = true;
|
|
32
|
-
this._handler({}, {
|
|
33
|
-
|
|
32
|
+
this._handler({}, {
|
|
33
|
+
error: {
|
|
34
|
+
message: message || 'Message rejected',
|
|
35
|
+
code: errorCode || 403,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* @desc Emits a direct message to the client
|
|
@@ -43,8 +47,18 @@ class ConnectionResponse extends abstractResponse_1.PondResponse {
|
|
|
43
47
|
throw new Error('EndpointResponse: Message has already been processed');
|
|
44
48
|
}
|
|
45
49
|
this._hasExecuted = true;
|
|
46
|
-
this._handler(assigns || {}, {
|
|
47
|
-
|
|
50
|
+
this._handler(assigns || {}, {
|
|
51
|
+
message: {
|
|
52
|
+
event,
|
|
53
|
+
payload,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @desc Resolves the request as sent with no further action
|
|
59
|
+
*/
|
|
60
|
+
end() {
|
|
61
|
+
throw new Error('EndpointResponse: Cannot end a connection response');
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
64
|
exports.ConnectionResponse = ConnectionResponse;
|
|
@@ -92,5 +92,11 @@ class JoinResponse extends abstractResponse_1.PondResponse {
|
|
|
92
92
|
this._engine.trackPresence(this._user.clientId, presence);
|
|
93
93
|
return this;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* @desc Resolves the request as sent with no further action
|
|
97
|
+
*/
|
|
98
|
+
end() {
|
|
99
|
+
this._hasExecuted = true;
|
|
100
|
+
}
|
|
95
101
|
}
|
|
96
102
|
exports.JoinResponse = JoinResponse;
|
package/types.d.ts
CHANGED
|
@@ -332,6 +332,11 @@ declare class EventResponse {
|
|
|
332
332
|
* @param reason - the reason for closing the channel
|
|
333
333
|
*/
|
|
334
334
|
closeChannel (reason: string): void;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @desc Resolves the request as sent with no further action
|
|
338
|
+
*/
|
|
339
|
+
end (): void;
|
|
335
340
|
}
|
|
336
341
|
|
|
337
342
|
declare class JoinRequest extends AbstractRequest {
|
|
@@ -393,6 +398,11 @@ declare class JoinResponse {
|
|
|
393
398
|
* @param presence - the presence data to track
|
|
394
399
|
*/
|
|
395
400
|
trackPresence (presence: PondPresence): JoinResponse;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* @desc Resolves the request as sent with no further action
|
|
404
|
+
*/
|
|
405
|
+
end (): void;
|
|
396
406
|
}
|
|
397
407
|
|
|
398
408
|
declare class PondChannel {
|
|
@@ -459,6 +469,11 @@ declare class ConnectionResponse {
|
|
|
459
469
|
* @param assigns - the data to assign to the client
|
|
460
470
|
*/
|
|
461
471
|
send (event: string, payload: PondMessage, assigns?: PondAssigns): void;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* @desc Resolves the request as sent with no further action
|
|
475
|
+
*/
|
|
476
|
+
end (): void;
|
|
462
477
|
}
|
|
463
478
|
|
|
464
479
|
declare class Endpoint {
|