@eleven-am/pondsocket-client 0.0.31 → 0.0.32
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/browser/client.js +10 -1
- package/browser/sseClient.js +10 -1
- package/core/channel.js +8 -0
- package/package.json +5 -5
package/browser/client.js
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _PondClient_instances, _PondClient_channels, _PondClient_clearTimeouts, _PondClient_createPublisher, _PondClient_handleAcknowledge, _PondClient_init;
|
|
13
|
+
var _PondClient_instances, _PondClient_channels, _PondClient_clearTimeouts, _PondClient_createPublisher, _PondClient_handleAcknowledge, _PondClient_handleUnauthorized, _PondClient_init;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.PondClient = void 0;
|
|
16
16
|
const pondsocket_common_1 = require("@eleven-am/pondsocket-common");
|
|
@@ -173,11 +173,20 @@ _PondClient_channels = new WeakMap(), _PondClient_instances = new WeakSet(), _Po
|
|
|
173
173
|
const channel = (_a = __classPrivateFieldGet(this, _PondClient_channels, "f").get(message.channelName)) !== null && _a !== void 0 ? _a : new channel_1.Channel(__classPrivateFieldGet(this, _PondClient_instances, "m", _PondClient_createPublisher).call(this), this._connectionState, message.channelName, {});
|
|
174
174
|
__classPrivateFieldGet(this, _PondClient_channels, "f").set(message.channelName, channel);
|
|
175
175
|
channel.acknowledge(this._broadcaster);
|
|
176
|
+
}, _PondClient_handleUnauthorized = function _PondClient_handleUnauthorized(message) {
|
|
177
|
+
const channel = __classPrivateFieldGet(this, _PondClient_channels, "f").get(message.channelName);
|
|
178
|
+
if (channel) {
|
|
179
|
+
const payload = message.payload;
|
|
180
|
+
channel.decline(payload);
|
|
181
|
+
}
|
|
176
182
|
}, _PondClient_init = function _PondClient_init() {
|
|
177
183
|
this._broadcaster.subscribe((message) => {
|
|
178
184
|
if (message.event === pondsocket_common_1.Events.ACKNOWLEDGE) {
|
|
179
185
|
__classPrivateFieldGet(this, _PondClient_instances, "m", _PondClient_handleAcknowledge).call(this, message);
|
|
180
186
|
}
|
|
187
|
+
else if (message.event === pondsocket_common_1.Events.UNAUTHORIZED) {
|
|
188
|
+
__classPrivateFieldGet(this, _PondClient_instances, "m", _PondClient_handleUnauthorized).call(this, message);
|
|
189
|
+
}
|
|
181
190
|
else if (message.event === pondsocket_common_1.Events.CONNECTION && message.action === pondsocket_common_1.ServerActions.CONNECT) {
|
|
182
191
|
this._connectionState.publish(types_1.ConnectionState.CONNECTED);
|
|
183
192
|
}
|
package/browser/sseClient.js
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _SSEClient_instances, _SSEClient_channels, _SSEClient_handleMessage, _SSEClient_clearTimeout, _SSEClient_createPublisher, _SSEClient_handleAcknowledge, _SSEClient_init;
|
|
13
|
+
var _SSEClient_instances, _SSEClient_channels, _SSEClient_handleMessage, _SSEClient_clearTimeout, _SSEClient_createPublisher, _SSEClient_handleAcknowledge, _SSEClient_handleUnauthorized, _SSEClient_init;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SSEClient = void 0;
|
|
16
16
|
const pondsocket_common_1 = require("@eleven-am/pondsocket-common");
|
|
@@ -178,11 +178,20 @@ _SSEClient_channels = new WeakMap(), _SSEClient_instances = new WeakSet(), _SSEC
|
|
|
178
178
|
const channel = (_a = __classPrivateFieldGet(this, _SSEClient_channels, "f").get(message.channelName)) !== null && _a !== void 0 ? _a : new channel_1.Channel(__classPrivateFieldGet(this, _SSEClient_instances, "m", _SSEClient_createPublisher).call(this), this._connectionState, message.channelName, {});
|
|
179
179
|
__classPrivateFieldGet(this, _SSEClient_channels, "f").set(message.channelName, channel);
|
|
180
180
|
channel.acknowledge(this._broadcaster);
|
|
181
|
+
}, _SSEClient_handleUnauthorized = function _SSEClient_handleUnauthorized(message) {
|
|
182
|
+
const channel = __classPrivateFieldGet(this, _SSEClient_channels, "f").get(message.channelName);
|
|
183
|
+
if (channel) {
|
|
184
|
+
const payload = message.payload;
|
|
185
|
+
channel.decline(payload);
|
|
186
|
+
}
|
|
181
187
|
}, _SSEClient_init = function _SSEClient_init() {
|
|
182
188
|
this._broadcaster.subscribe((message) => {
|
|
183
189
|
if (message.event === pondsocket_common_1.Events.ACKNOWLEDGE) {
|
|
184
190
|
__classPrivateFieldGet(this, _SSEClient_instances, "m", _SSEClient_handleAcknowledge).call(this, message);
|
|
185
191
|
}
|
|
192
|
+
else if (message.event === pondsocket_common_1.Events.UNAUTHORIZED) {
|
|
193
|
+
__classPrivateFieldGet(this, _SSEClient_instances, "m", _SSEClient_handleUnauthorized).call(this, message);
|
|
194
|
+
}
|
|
186
195
|
else if (message.event === pondsocket_common_1.Events.CONNECTION && message.action === pondsocket_common_1.ServerActions.CONNECT) {
|
|
187
196
|
this._connectionState.publish(types_1.ConnectionState.CONNECTED);
|
|
188
197
|
}
|
package/core/channel.js
CHANGED
|
@@ -60,6 +60,14 @@ class Channel {
|
|
|
60
60
|
__classPrivateFieldGet(this, _Channel_instances, "m", _Channel_init).call(this, receiver);
|
|
61
61
|
__classPrivateFieldGet(this, _Channel_instances, "m", _Channel_emptyQueue).call(this);
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* @desc Marks the channel join as declined by the server.
|
|
65
|
+
* @param payload - The decline payload containing status code and message.
|
|
66
|
+
*/
|
|
67
|
+
decline(payload) {
|
|
68
|
+
__classPrivateFieldGet(this, _Channel_joinState, "f").publish(pondsocket_common_1.ChannelState.DECLINED);
|
|
69
|
+
__classPrivateFieldSet(this, _Channel_queue, [], "f");
|
|
70
|
+
}
|
|
63
71
|
/**
|
|
64
72
|
* @desc Connects to the channel.
|
|
65
73
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eleven-am/pondsocket-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "PondSocket is a fast simple socket server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"socket",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"pipeline": "npm run test && npm run build && npm run push"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@eleven-am/pondsocket-common": "^0.0.
|
|
33
|
+
"@eleven-am/pondsocket-common": "^0.0.34",
|
|
34
34
|
"websocket": "^1.0.35"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/jest": "^30.0.0",
|
|
38
38
|
"@types/websocket": "^1.0.10",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
40
40
|
"eslint-plugin-file-progress": "^3.0.2",
|
|
41
41
|
"eslint-plugin-import": "^2.32.0",
|
|
42
42
|
"jest": "^30.2.0",
|
|
43
|
-
"prettier": "^3.
|
|
43
|
+
"prettier": "^3.7.4",
|
|
44
44
|
"supertest": "^7.1.4",
|
|
45
|
-
"ts-jest": "^29.4.
|
|
45
|
+
"ts-jest": "^29.4.6",
|
|
46
46
|
"ts-loader": "^9.5.4",
|
|
47
47
|
"ts-node": "^10.9.2",
|
|
48
48
|
"typescript": "^5.9.3"
|