|
2565 | 2565 | return latencies;
|
2566 | 2566 | };
|
2567 | 2567 | default_1.prototype.startLatencyMeasure = function (operationType, identifier) {
|
2568 |
| - if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) { |
| 2568 | + if (operationType === OPERATIONS.PNSubscribeOperation || |
| 2569 | + OPERATIONS.PNReceiveMessagesOperation || |
| 2570 | + !identifier) { |
2569 | 2571 | return;
|
2570 | 2572 | }
|
2571 | 2573 | this._trackedLatencies[identifier] = Date.now();
|
2572 | 2574 | };
|
2573 | 2575 | default_1.prototype.stopLatencyMeasure = function (operationType, identifier) {
|
2574 |
| - if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) { |
| 2576 | + if (operationType === OPERATIONS.PNSubscribeOperation || |
| 2577 | + OPERATIONS.PNReceiveMessagesOperation || |
| 2578 | + !identifier) { |
2575 | 2579 | return;
|
2576 | 2580 | }
|
2577 | 2581 | var endpointName = this._endpointName(operationType);
|
|
6731 | 6735 | },
|
6732 | 6736 | getURL: function (_a, params) {
|
6733 | 6737 | var config = _a.config;
|
6734 |
| - var channelsString = params.channels ? params.channels.join(',') : ','; |
6735 |
| - return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0"); |
| 6738 | + var _b = params.channels, channels = _b === void 0 ? [] : _b; |
| 6739 | + var stringifiedChannels = channels.length > 0 ? channels.join(',') : ','; |
| 6740 | + return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0"); |
6736 | 6741 | },
|
6737 | 6742 | getRequestTimeout: function (_a) {
|
6738 | 6743 | var config = _a.config;
|
|
6775 | 6780 | },
|
6776 | 6781 | getURL: function (_a, params) {
|
6777 | 6782 | var config = _a.config;
|
6778 |
| - var channelsString = params.channels ? params.channels.join(',') : ','; |
6779 |
| - return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0"); |
| 6783 | + var _b = params.channels, channels = _b === void 0 ? [] : _b; |
| 6784 | + var stringifiedChannels = channels.length > 0 ? channels.join(',') : ','; |
| 6785 | + return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0"); |
6780 | 6786 | },
|
6781 | 6787 | getRequestTimeout: function (_a) {
|
6782 | 6788 | var config = _a.config;
|
|
7726 | 7732 | EventEngine.prototype.subscribe = function (_a) {
|
7727 | 7733 | var _this = this;
|
7728 | 7734 | var channels = _a.channels, channelGroups = _a.channelGroups, timetoken = _a.timetoken, withPresence = _a.withPresence;
|
7729 |
| - this.channels = __spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false); |
7730 |
| - this.groups = __spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false); |
| 7735 | + this.channels = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false))); |
| 7736 | + this.groups = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false))); |
7731 | 7737 | if (withPresence) {
|
7732 | 7738 | this.channels.map(function (c) { return _this.channels.push("".concat(c, "-pnpres")); });
|
7733 | 7739 | this.groups.map(function (g) { return _this.groups.push("".concat(g, "-pnpres")); });
|
|
8420 | 8426 | EventEmitter.prototype.addListener = function (l, channels, groups) {
|
8421 | 8427 | var _this = this;
|
8422 | 8428 | channels.forEach(function (c) {
|
8423 |
| - return _this._channelListenerMap[c] ? _this._channelListenerMap[c].push(l) : (_this._channelListenerMap[c] = [l]); |
| 8429 | + if (_this._channelListenerMap[c]) { |
| 8430 | + if (!_this._channelListenerMap[c].includes(l)) |
| 8431 | + _this._channelListenerMap[c].push(l); |
| 8432 | + } |
| 8433 | + else { |
| 8434 | + _this._channelListenerMap[c] = [l]; |
| 8435 | + } |
8424 | 8436 | });
|
8425 | 8437 | groups.forEach(function (g) {
|
8426 |
| - return _this._groupListenerMap[g] ? _this._groupListenerMap[g].push(l) : (_this._groupListenerMap[g] = [l]); |
| 8438 | + if (_this._groupListenerMap[g]) { |
| 8439 | + if (!_this._groupListenerMap[g].includes(l)) |
| 8440 | + _this._groupListenerMap[g].push(l); |
| 8441 | + } |
| 8442 | + else { |
| 8443 | + _this._groupListenerMap[g] = [l]; |
| 8444 | + } |
8427 | 8445 | });
|
8428 | 8446 | };
|
8429 | 8447 | EventEmitter.prototype.removeListener = function (listener, channels, groups) {
|
|
0 commit comments