@eleven-am/pondsocket 0.1.145 → 0.1.146

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.
@@ -114,9 +114,11 @@ class EndpointEngine {
114
114
  __classPrivateFieldGet(this, _EndpointEngine_instances, "m", _EndpointEngine_readMessage).call(this, cache, message.data);
115
115
  });
116
116
  socket.addEventListener('close', () => {
117
+ __classPrivateFieldGet(this, _EndpointEngine_sockets, "f").delete(cache.clientId);
117
118
  cache.subscriptions.forEach((unsubscribe) => unsubscribe());
118
119
  });
119
120
  socket.addEventListener('error', () => {
121
+ __classPrivateFieldGet(this, _EndpointEngine_sockets, "f").delete(cache.clientId);
120
122
  cache.subscriptions.forEach((unsubscribe) => unsubscribe());
121
123
  });
122
124
  }
@@ -168,6 +170,10 @@ class EndpointEngine {
168
170
  throw new pondError_1.EndpointError(`GatewayEngine: User ${userId} is not subscribed to ${channel}`, 404);
169
171
  }
170
172
  }
173
+ /**
174
+ * @desc Subscribes all pending users to a channel
175
+ * @param channel - The channel to subscribe the users to
176
+ */
171
177
  subscribePendingUsers(channel) {
172
178
  const users = [...__classPrivateFieldGet(this, _EndpointEngine_sockets, "f").values()]
173
179
  .filter(({ pendingSubscriptions }) => pendingSubscriptions.has(channel.name));
@@ -297,6 +303,7 @@ _EndpointEngine_middleware = new WeakMap(), _EndpointEngine_channels = new WeakM
297
303
  throw new pondError_1.EndpointError(`GatewayEngine: Channel ${channel} does not exist`, 404);
298
304
  }
299
305
  unsubscribe();
306
+ socket.subscriptions.delete(channel);
300
307
  };
301
308
  class Endpoint {
302
309
  constructor(engine) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.145",
3
+ "version": "0.1.146",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",