@eleven-am/pondsocket 0.1.8 → 0.1.9

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.
@@ -1,58 +1,102 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __values = (this && this.__values) || function(o) {
29
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30
+ if (m) return m.call(o);
31
+ if (o && typeof o.length === "number") return {
32
+ next: function () {
33
+ if (o && i >= o.length) o = void 0;
34
+ return { value: o && o[i++], done: !o };
35
+ }
36
+ };
37
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
38
+ };
2
39
  Object.defineProperty(exports, "__esModule", { value: true });
3
40
  exports.PondChannel = void 0;
4
- const pondBase_1 = require("../pondBase");
5
- const channel_1 = require("./channel");
6
- const enums_1 = require("./enums");
7
- const pondResponse_1 = require("./pondResponse");
8
- const channelMiddleWare_1 = require("./channelMiddleWare");
9
- class PondChannel extends pondBase_1.BaseClass {
10
- constructor(path, handler) {
11
- super();
12
- this._channels = new pondBase_1.PondBase();
13
- this._handler = handler;
14
- this.path = path;
15
- this._subscriptions = {};
16
- this._middleware = new channelMiddleWare_1.ChannelMiddleware();
17
- }
18
- /**
19
- * @desc Gets a list of all the channels in the endpoint.
20
- */
21
- get info() {
22
- return this._channels.map(channel => channel.info);
41
+ var pondBase_1 = require("../pondBase");
42
+ var channel_1 = require("./channel");
43
+ var enums_1 = require("./enums");
44
+ var pondResponse_1 = require("./pondResponse");
45
+ var channelMiddleWare_1 = require("./channelMiddleWare");
46
+ var PondChannel = /** @class */ (function (_super) {
47
+ __extends(PondChannel, _super);
48
+ function PondChannel(path, handler) {
49
+ var _this = _super.call(this) || this;
50
+ _this._channels = new pondBase_1.PondBase();
51
+ _this._handler = handler;
52
+ _this.path = path;
53
+ _this._subscriptions = {};
54
+ _this._middleware = new channelMiddleWare_1.ChannelMiddleware();
55
+ return _this;
23
56
  }
57
+ Object.defineProperty(PondChannel.prototype, "info", {
58
+ /**
59
+ * @desc Gets a list of all the channels in the endpoint.
60
+ */
61
+ get: function () {
62
+ return this._channels.map(function (channel) { return channel.info; });
63
+ },
64
+ enumerable: false,
65
+ configurable: true
66
+ });
24
67
  /**
25
68
  * @desc Sends a message to a client
26
69
  * @param socket - The socket to send the message to
27
70
  * @param message - The message to send
28
71
  */
29
- static _sendMessage(socket, message) {
72
+ PondChannel._sendMessage = function (socket, message) {
30
73
  socket.send(JSON.stringify(message));
31
- }
74
+ };
32
75
  /**
33
76
  * @desc A listener for a channel event
34
77
  * @param event - The event to listen for, can be a regex
35
78
  * @param callback - The callback to call when the event is received
36
79
  */
37
- on(event, callback) {
80
+ PondChannel.prototype.on = function (event, callback) {
38
81
  this._buildHandler(event, callback);
39
- }
82
+ };
40
83
  /**
41
84
  * @desc Add new user to channel
42
85
  * @param user - The user to add to the channel
43
86
  * @param channelName - The name of the channel
44
87
  * @param joinParams - The params to join the channel with
45
88
  */
46
- addUser(user, channelName, joinParams) {
47
- const document = this._getChannel(channelName);
48
- const channel = document.doc;
49
- const resolver = (newAssigns, message) => {
50
- const { assigns, presence, channelData } = newAssigns;
51
- this._subscriptions[user.clientId] = this._subscriptions[user.clientId] || [];
52
- const sub = channel.subscribeToMessages(user.clientId, (event) => {
89
+ PondChannel.prototype.addUser = function (user, channelName, joinParams) {
90
+ var _this = this;
91
+ var document = this._getChannel(channelName);
92
+ var channel = document.doc;
93
+ var resolver = function (newAssigns, message) {
94
+ var assigns = newAssigns.assigns, presence = newAssigns.presence, channelData = newAssigns.channelData;
95
+ _this._subscriptions[user.clientId] = _this._subscriptions[user.clientId] || [];
96
+ var sub = channel.subscribeToMessages(user.clientId, function (event) {
53
97
  PondChannel._sendMessage(user.socket, event);
54
98
  });
55
- this._subscriptions[user.clientId].push({ name: channelName, sub });
99
+ _this._subscriptions[user.clientId].push({ name: channelName, sub: sub });
56
100
  channel.addUser({
57
101
  presence: presence,
58
102
  assigns: assigns,
@@ -62,65 +106,62 @@ class PondChannel extends pondBase_1.BaseClass {
62
106
  if (message)
63
107
  channel.sendTo(message.event, message.payload, enums_1.PondSenders.POND_CHANNEL, [user.clientId]);
64
108
  };
65
- const response = new pondResponse_1.PondChannelResponse(user, resolver);
66
- const resolved = this.generateEventRequest(this.path, channelName);
109
+ var response = new pondResponse_1.PondChannelResponse(user, resolver);
110
+ var resolved = this.generateEventRequest(this.path, channelName);
67
111
  if (resolved === null) {
68
112
  document.removeDoc();
69
- return response.reject(`Invalid channel name: ${channelName}`);
113
+ return response.reject("Invalid channel name: ".concat(channelName));
70
114
  }
71
- const request = {
72
- joinParams, ...resolved,
73
- clientId: user.clientId, channelName,
74
- clientAssigns: user.assigns
75
- };
115
+ var request = __assign(__assign({ joinParams: joinParams }, resolved), { clientId: user.clientId, channelName: channelName, clientAssigns: user.assigns });
76
116
  this._handler(request, response, channel);
77
117
  if (channel.presence.length === 0)
78
118
  document.removeDoc();
79
119
  if (!response.isResolved)
80
120
  throw new Error("PondChannel: Response was not resolved");
81
- }
121
+ };
82
122
  /**
83
123
  * @desc Sends a message to a channel in the endpoint.
84
124
  * @param channelName - The name of the channel to send the message to.
85
125
  * @param event - The event to send the message with.
86
126
  * @param message - The message to send.
87
127
  */
88
- broadcastToChannel(channelName, event, message) {
89
- this._execute(channelName, channel => {
128
+ PondChannel.prototype.broadcastToChannel = function (channelName, event, message) {
129
+ this._execute(channelName, function (channel) {
90
130
  channel.broadcast(event, message, enums_1.PondSenders.POND_CHANNEL);
91
131
  });
92
- }
132
+ };
93
133
  /**
94
134
  * @desc Closes a client connection to a channel in the endpoint.
95
135
  * @param channelName - The name of the channel to close the connection to.
96
136
  * @param clientId - The id of the client to close the connection to.
97
137
  */
98
- closeFromChannel(channelName, clientId) {
99
- this._execute(channelName, channel => {
100
- this._removeSubscriptions(clientId, channelName);
138
+ PondChannel.prototype.closeFromChannel = function (channelName, clientId) {
139
+ var _this = this;
140
+ this._execute(channelName, function (channel) {
141
+ _this._removeSubscriptions(clientId, channelName);
101
142
  channel.removeUser(clientId);
102
143
  });
103
- }
144
+ };
104
145
  /**
105
146
  * @desc Modify the presence of a client in a channel on the endpoint.
106
147
  * @param channelName - The name of the channel to modify the presence of.
107
148
  * @param clientId - The id of the client to modify the presence of.
108
149
  * @param assigns - The assigns to modify the presence with.
109
150
  */
110
- modifyPresence(channelName, clientId, assigns) {
111
- this._execute(channelName, channel => {
151
+ PondChannel.prototype.modifyPresence = function (channelName, clientId, assigns) {
152
+ this._execute(channelName, function (channel) {
112
153
  channel.updateUser(clientId, assigns.presence || {}, assigns.assigns || {});
113
154
  });
114
- }
155
+ };
115
156
  /**
116
157
  * @desc Gets the information of the channel
117
158
  * @param channelName - The name of the channel to get the information of.
118
159
  */
119
- getChannelInfo(channelName) {
120
- return this._execute(channelName, channel => {
160
+ PondChannel.prototype.getChannelInfo = function (channelName) {
161
+ return this._execute(channelName, function (channel) {
121
162
  return channel.info;
122
163
  });
123
- }
164
+ };
124
165
  /**
125
166
  * @desc Sends a message to the channel
126
167
  * @param channelName - The name of the channel to send the message to.
@@ -128,92 +169,104 @@ class PondChannel extends pondBase_1.BaseClass {
128
169
  * @param event - The event to send the message to
129
170
  * @param message - The message to send
130
171
  */
131
- send(channelName, clientId, event, message) {
132
- const clients = Array.isArray(clientId) ? clientId : [clientId];
133
- this._execute(channelName, channel => {
172
+ PondChannel.prototype.send = function (channelName, clientId, event, message) {
173
+ var clients = Array.isArray(clientId) ? clientId : [clientId];
174
+ this._execute(channelName, function (channel) {
134
175
  channel.sendTo(event, message, enums_1.PondSenders.POND_CHANNEL, clients);
135
176
  });
136
- }
177
+ };
137
178
  /**
138
179
  * @desc Searches for a channel in the endpoint.
139
180
  * @param channelName - The name of the channel to search for.
140
181
  */
141
- getChannel(channelName) {
182
+ PondChannel.prototype.getChannel = function (channelName) {
142
183
  var _a;
143
184
  return ((_a = this._channels.get(channelName)) === null || _a === void 0 ? void 0 : _a.doc) || null;
144
- }
185
+ };
145
186
  /**
146
187
  * @desc removes a user from all channels
147
188
  * @param clientId - The id of the client to remove
148
189
  */
149
- removeUser(clientId) {
190
+ PondChannel.prototype.removeUser = function (clientId) {
191
+ var e_1, _a;
150
192
  if (this._subscriptions[clientId]) {
151
- this._subscriptions[clientId].forEach(doc => doc.sub.unsubscribe());
193
+ this._subscriptions[clientId].forEach(function (doc) { return doc.sub.unsubscribe(); });
152
194
  delete this._subscriptions[clientId];
153
- for (const channel of this._channels)
154
- if (channel.doc.hasUser(clientId))
155
- channel.doc.removeUser(clientId);
195
+ try {
196
+ for (var _b = __values(this._channels), _c = _b.next(); !_c.done; _c = _b.next()) {
197
+ var channel = _c.value;
198
+ if (channel.doc.hasUser(clientId))
199
+ channel.doc.removeUser(clientId);
200
+ }
201
+ }
202
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
203
+ finally {
204
+ try {
205
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
206
+ }
207
+ finally { if (e_1) throw e_1.error; }
208
+ }
156
209
  }
157
- }
210
+ };
158
211
  /**
159
212
  * @desc Executes a function on a channel in the endpoint.
160
213
  * @param channelName - The name of the channel to execute the function on.
161
214
  * @param handler - The function to execute on the channel.
162
215
  * @private
163
216
  */
164
- _execute(channelName, handler) {
165
- const newChannel = this.getChannel(channelName);
217
+ PondChannel.prototype._execute = function (channelName, handler) {
218
+ var newChannel = this.getChannel(channelName);
166
219
  if (newChannel)
167
220
  return handler(newChannel);
168
- throw new Error(`Channel ${channelName} does not exist`);
169
- }
221
+ throw new Error("Channel ".concat(channelName, " does not exist"));
222
+ };
170
223
  /**
171
224
  * @desc Creates a new channel in the endpoint.
172
225
  * @param channelName - The name of the channel to create.
173
226
  * @private
174
227
  */
175
- _getChannel(channelName) {
176
- return this._channels.getOrCreate(channelName, doc => {
177
- return new channel_1.Channel(channelName, this._middleware, doc.removeDoc.bind(doc));
228
+ PondChannel.prototype._getChannel = function (channelName) {
229
+ var _this = this;
230
+ return this._channels.getOrCreate(channelName, function (doc) {
231
+ return new channel_1.Channel(channelName, _this._middleware, doc.removeDoc.bind(doc));
178
232
  });
179
- }
233
+ };
180
234
  /**
181
235
  * @desc Removes a subscription from a user
182
236
  * @param clientId - The id of the client to remove the subscription from
183
237
  * @param channelName - The name of the channel to remove the subscription from
184
238
  * @private
185
239
  */
186
- _removeSubscriptions(clientId, channelName) {
187
- const clients = Array.isArray(clientId) ? clientId : [clientId];
188
- clients.forEach(client => {
189
- const subs = this._subscriptions[client];
240
+ PondChannel.prototype._removeSubscriptions = function (clientId, channelName) {
241
+ var _this = this;
242
+ var clients = Array.isArray(clientId) ? clientId : [clientId];
243
+ clients.forEach(function (client) {
244
+ var subs = _this._subscriptions[client];
190
245
  if (subs) {
191
- const sub = subs.find(s => s.name === channelName);
246
+ var sub = subs.find(function (s) { return s.name === channelName; });
192
247
  if (sub) {
193
248
  sub.sub.unsubscribe();
194
249
  subs.splice(subs.indexOf(sub), 1);
195
250
  }
196
251
  }
197
252
  });
198
- }
253
+ };
199
254
  /**
200
255
  * @desc Builds an event handler for a channel
201
256
  * @param event - The event to build the handler for
202
257
  * @param callback - The callback to build the handler for
203
258
  * @private
204
259
  */
205
- _buildHandler(event, callback) {
206
- this._middleware.use((data, res, channel) => {
207
- const info = this.generateEventRequest(event, data.event);
260
+ PondChannel.prototype._buildHandler = function (event, callback) {
261
+ var _this = this;
262
+ this._middleware.use(function (data, res, channel) {
263
+ var info = _this.generateEventRequest(event, data.event);
208
264
  if (!info)
209
265
  return;
210
- const req = {
211
- ...data,
212
- params: info.params,
213
- query: info.query,
214
- };
266
+ var req = __assign(__assign({}, data), { params: info.params, query: info.query });
215
267
  callback(req, res, channel);
216
268
  });
217
- }
218
- }
269
+ };
270
+ return PondChannel;
271
+ }(pondBase_1.BaseClass));
219
272
  exports.PondChannel = PondChannel;
@@ -1,34 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const pondChannel_1 = require("./pondChannel");
4
- const channel_test_1 = require("./channel.test");
5
- const enums_1 = require("./enums");
6
- const channel_1 = require("./channel");
7
- const pondBase_1 = require("../pondBase");
8
- const createPondChannel = (path, handler) => {
3
+ var pondChannel_1 = require("./pondChannel");
4
+ var channel_test_1 = require("./channel.test");
5
+ var enums_1 = require("./enums");
6
+ var channel_1 = require("./channel");
7
+ var pondBase_1 = require("../pondBase");
8
+ var createPondChannel = function (path, handler) {
9
9
  path = path || "/pond";
10
10
  handler = handler || jest.fn();
11
11
  return new pondChannel_1.PondChannel(path, handler);
12
12
  };
13
- describe('PondChannel', () => {
14
- it('should exists', () => {
13
+ describe('PondChannel', function () {
14
+ it('should exists', function () {
15
15
  expect(pondChannel_1.PondChannel).toBeDefined();
16
16
  });
17
- it('should be a class', () => {
17
+ it('should be a class', function () {
18
18
  expect(pondChannel_1.PondChannel).toBeInstanceOf(Function);
19
19
  });
20
- it('should be able to get the info of a channel', () => {
21
- const pondChannel = createPondChannel();
22
- const { channel } = (0, channel_test_1.createChannel)('/channel');
20
+ it('should be able to get the info of a channel', function () {
21
+ var pondChannel = createPondChannel();
22
+ var channel = (0, channel_test_1.createChannel)('/channel').channel;
23
23
  // Because we want to get the info of the channel, we need to add it to the pondChannel
24
24
  // for testing purposes
25
25
  pondChannel['_channels'].set(channel.name, channel);
26
26
  expect(pondChannel.info).toEqual([channel.info]);
27
27
  });
28
- it('should be able ot add a user', () => {
29
- const pondChannel = createPondChannel('/test');
30
- expect(() => pondChannel.getChannelInfo('/test')).toThrow(); // This throws an error because the channel does not exist anymore
31
- const testUser = {
28
+ it('should be able ot add a user', function () {
29
+ var pondChannel = createPondChannel('/test');
30
+ expect(function () { return pondChannel.getChannelInfo('/test'); }).toThrow(); // This throws an error because the channel does not exist anymore
31
+ var testUser = {
32
32
  clientId: 'test', assigns: {}, socket: {
33
33
  send: jest.fn(), on: jest.fn(),
34
34
  }
@@ -37,25 +37,25 @@ describe('PondChannel', () => {
37
37
  // /balls !== /test so we expect an error message to be sent to the client from the pond channel
38
38
  expect(testUser.socket.send).toBeCalledWith(JSON.stringify({
39
39
  action: enums_1.ServerActions.ERROR, event: "JOIN_REQUEST_ERROR", channelName: enums_1.PondSenders.POND_CHANNEL, payload: {
40
- message: `Invalid channel name: /balls`, code: 403,
40
+ message: "Invalid channel name: /balls", code: 403,
41
41
  }
42
42
  }));
43
43
  expect(pondChannel.getChannel('/test')).toBeNull(); // The channel does not exist yet
44
- expect(() => pondChannel.addUser(testUser, '/test', {}))
44
+ expect(function () { return pondChannel.addUser(testUser, '/test', {}); })
45
45
  .toThrow(); // handler function does not act on the incoming connection, it is just a jest mock function
46
46
  // /test === /test so we expect the user to be added to the channel
47
47
  // if the channel does not exist, it will be created
48
48
  expect(pondChannel.getChannel('/test')).toBeNull(); // The channel does not exist yet
49
- const newPondChannel = new pondChannel_1.PondChannel('/test', (_, res) => {
49
+ var newPondChannel = new pondChannel_1.PondChannel('/test', function (_, res) {
50
50
  res.accept(); // here we accept the connection
51
51
  });
52
52
  newPondChannel.addUser(testUser, '/test', {});
53
53
  expect(newPondChannel.getChannel('/test')).not.toBeNull(); // The channel does exist now
54
- const newChannel = newPondChannel.getChannel('/test');
54
+ var newChannel = newPondChannel.getChannel('/test');
55
55
  expect(newChannel).toBeDefined();
56
56
  expect(newChannel).toBeInstanceOf(channel_1.Channel);
57
57
  expect(newChannel === null || newChannel === void 0 ? void 0 : newChannel.name).toBe('/test');
58
- const rejectPondChannel = new pondChannel_1.PondChannel('/:test', (req, res) => {
58
+ var rejectPondChannel = new pondChannel_1.PondChannel('/:test', function (req, res) {
59
59
  if (req.params.test === 'balls')
60
60
  res.reject(); // here we reject the connection
61
61
  else if (req.params.test === 'rejectWithMessage')
@@ -66,24 +66,24 @@ describe('PondChannel', () => {
66
66
  expect(rejectPondChannel.getChannel('/rejectWithMessage')).toBeNull(); // The channel does not exist as it rejects the connection and deletes itself
67
67
  expect(testUser.socket.send).toBeCalledWith(JSON.stringify({
68
68
  action: enums_1.ServerActions.ERROR, event: "JOIN_REQUEST_ERROR", channelName: enums_1.PondSenders.POND_CHANNEL, payload: {
69
- message: `test`, code: 69420,
69
+ message: "test", code: 69420,
70
70
  }
71
71
  }));
72
72
  rejectPondChannel.addUser(testUser, '/balls', {});
73
73
  expect(rejectPondChannel.getChannel('/balls')).toBeNull(); // The channel does not exist as it rejects the connection and deletes itself
74
74
  expect(testUser.socket.send).toBeCalledWith(JSON.stringify({
75
75
  action: enums_1.ServerActions.ERROR, event: "JOIN_REQUEST_ERROR", channelName: enums_1.PondSenders.POND_CHANNEL, payload: {
76
- message: `Unauthorized join request`, code: 403,
76
+ message: "Unauthorized join request", code: 403,
77
77
  }
78
78
  }));
79
- const acceptPondChannel = new pondChannel_1.PondChannel('/:test', (_, res) => {
79
+ var acceptPondChannel = new pondChannel_1.PondChannel('/:test', function (_, res) {
80
80
  res.send('test', {
81
81
  test: 'test'
82
82
  }); // here we send a message after accepting the connection
83
83
  });
84
84
  testUser.socket.send.mockClear(); // Clear the mock function
85
- const messages = [];
86
- testUser.socket.send = (message) => {
85
+ var messages = [];
86
+ testUser.socket.send = function (message) {
87
87
  messages.push(JSON.parse(message));
88
88
  };
89
89
  acceptPondChannel.addUser(testUser, '/test', {});
@@ -97,18 +97,18 @@ describe('PondChannel', () => {
97
97
  }
98
98
  }]);
99
99
  });
100
- it('should be able to receive subscriptions', () => {
101
- const pond = new pondChannel_1.PondChannel('/:test', (_, res) => {
100
+ it('should be able to receive subscriptions', function () {
101
+ var pond = new pondChannel_1.PondChannel('/:test', function (_, res) {
102
102
  res.accept();
103
103
  });
104
104
  //when events are added, they are added sequentially
105
105
  // this means the first handler is called first, and the second handler is called second...
106
106
  // so if a regex handler should be added last so everything else can be tried first
107
- let narrowedMessageCount = 0;
108
- pond.on('event:test', (req, res) => {
107
+ var narrowedMessageCount = 0;
108
+ pond.on('event:test', function (req, res) {
109
109
  narrowedMessageCount++;
110
110
  if (req.params.test === 'balls')
111
- expect(() => res.reject()).toThrow(); // this would throw an error because the sender is the pond channel itself
111
+ expect(function () { return res.reject(); }).toThrow(); // this would throw an error because the sender is the pond channel itself
112
112
  // we know this because we wrote the test that way, to confirm who the sender is you can check the req.client property
113
113
  else if (req.params.test === 'rejectWithMessage')
114
114
  res.reject('test', 69420); // here we reject the connection with a message and a status code
@@ -149,8 +149,8 @@ describe('PondChannel', () => {
149
149
  }
150
150
  });
151
151
  });
152
- let encompassingMessageCount = 0;
153
- pond.on(/(.*?)/, (req, res) => {
152
+ var encompassingMessageCount = 0;
153
+ pond.on(/(.*?)/, function (req, res) {
154
154
  console.log(req.event);
155
155
  expect(req.params).toEqual({});
156
156
  // with all encompassing regex, the params should be empty
@@ -161,8 +161,8 @@ describe('PondChannel', () => {
161
161
  message: 'This is a fallback route'
162
162
  });
163
163
  });
164
- let userMessageCount = 0;
165
- const sender = () => {
164
+ var userMessageCount = 0;
165
+ var sender = function () {
166
166
  userMessageCount++;
167
167
  };
168
168
  // we add two users to the pond on ethe channel /pond
@@ -207,7 +207,7 @@ describe('PondChannel', () => {
207
207
  encompassingMessageCount = 0;
208
208
  userMessageCount = 0;
209
209
  narrowedMessageCount = 0;
210
- const channel = pond.getChannel('/pond');
210
+ var channel = pond.getChannel('/pond');
211
211
  expect(channel).toBeInstanceOf(channel_1.Channel);
212
212
  expect(channel).not.toBeNull();
213
213
  // since the PondChannel has no way to send messages on behalf of a client we get the channel from the pond and send the message directly to the channel
@@ -339,12 +339,12 @@ describe('PondChannel', () => {
339
339
  assigns: [{}],
340
340
  });
341
341
  });
342
- it('should be capable of removing a user from a channel', () => {
343
- const pond = new pondChannel_1.PondChannel('/test', (_, res) => {
342
+ it('should be capable of removing a user from a channel', function () {
343
+ var pond = new pondChannel_1.PondChannel('/test', function (_, res) {
344
344
  res.accept(); // here we accept the connection
345
345
  });
346
- let userMessageCount = 0;
347
- const sender = () => {
346
+ var userMessageCount = 0;
347
+ var sender = function () {
348
348
  userMessageCount++;
349
349
  };
350
350
  pond.addUser({