@eleven-am/pondsocket 0.1.185 → 0.1.187
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/engines/endpointEngine.js +20 -1
- package/managers/manager.js +11 -6
- package/package.json +4 -4
|
@@ -136,12 +136,31 @@ _EndpointEngine_clientFactory = new WeakMap(), _EndpointEngine_sockets = new Wea
|
|
|
136
136
|
}
|
|
137
137
|
throw new httpError_1.HttpError(404, `GatewayEngine: Channel ${channel} does not exist`);
|
|
138
138
|
}, _EndpointEngine_buildError = function _EndpointEngine_buildError(error) {
|
|
139
|
+
let message;
|
|
140
|
+
let status;
|
|
141
|
+
if (error instanceof httpError_1.HttpError) {
|
|
142
|
+
message = error.message;
|
|
143
|
+
status = error.statusCode;
|
|
144
|
+
}
|
|
145
|
+
else if (error instanceof Error) {
|
|
146
|
+
message = error.message;
|
|
147
|
+
status = 500;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
message = 'An unknown error occurred';
|
|
151
|
+
status = 500;
|
|
152
|
+
}
|
|
139
153
|
const event = {
|
|
140
154
|
event: pondsocket_common_1.ErrorTypes.INVALID_MESSAGE,
|
|
141
155
|
action: pondsocket_common_1.ServerActions.ERROR,
|
|
142
156
|
channelName: pondsocket_common_1.SystemSender.ENDPOINT,
|
|
143
157
|
requestId: (0, pondsocket_common_1.uuid)(),
|
|
144
|
-
payload: {
|
|
158
|
+
payload: {
|
|
159
|
+
error: {
|
|
160
|
+
message,
|
|
161
|
+
status,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
145
164
|
};
|
|
146
165
|
return event;
|
|
147
166
|
}, _EndpointEngine_broadcastMessage = function _EndpointEngine_broadcastMessage(socket, message) {
|
package/managers/manager.js
CHANGED
|
@@ -95,12 +95,17 @@ class Manager {
|
|
|
95
95
|
removeUser(userId) {
|
|
96
96
|
var _a;
|
|
97
97
|
const userData = this.getUserData(userId);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.
|
|
98
|
+
try {
|
|
99
|
+
this.removePresence(userId);
|
|
100
|
+
this.removeAssigns(userId);
|
|
101
|
+
(_a = this.userSubscriptions.get(userId)) === null || _a === void 0 ? void 0 : _a();
|
|
102
|
+
this.userSubscriptions.delete(userId);
|
|
103
|
+
if (this.assignsCache.size === 0) {
|
|
104
|
+
this.close();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// no-op
|
|
104
109
|
}
|
|
105
110
|
return userData;
|
|
106
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eleven-am/pondsocket",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.187",
|
|
4
4
|
"description": "PondSocket is a fast simple socket server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"socket",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"ws": "^8.18.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@stylistic/eslint-plugin-ts": "^2.
|
|
42
|
+
"@stylistic/eslint-plugin-ts": "^2.9.0",
|
|
43
43
|
"@types/jest": "^29.5.13",
|
|
44
|
-
"@types/node": "^22.7.
|
|
44
|
+
"@types/node": "^22.7.7",
|
|
45
45
|
"@types/ws": "^8.5.12",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
47
|
-
"@typescript-eslint/parser": "^8.8.
|
|
47
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
48
48
|
"eslint": "^8.57.0",
|
|
49
49
|
"eslint-config-prettier": "^9.1.0",
|
|
50
50
|
"eslint-import-resolver-node": "^0.3.9",
|