@mtgame/core 0.2.39 → 0.2.40

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.
@@ -13538,6 +13538,7 @@
13538
13538
  CentrifugoService.prototype.unsubscribe = function (channel) {
13539
13539
  if (this.subscriptions[channel]) {
13540
13540
  this.subscriptions[channel].unsubscribe();
13541
+ this.centrifuge.removeSubscription(this.subscriptions[channel]);
13541
13542
  delete this.subscriptions[channel];
13542
13543
  }
13543
13544
  if (this.channels$[channel]) {
@@ -13610,10 +13611,13 @@
13610
13611
  };
13611
13612
  CentrifugoService.prototype.addEngineSubscription = function (channel) {
13612
13613
  var _this = this;
13613
- var sub = this.centrifuge.newSubscription(channel);
13614
- sub.on('publication', function (ctx) {
13615
- _this.resolveMessage(channel, ctx.data);
13616
- });
13614
+ var sub = this.centrifuge.getSubscription(channel);
13615
+ if (!sub) {
13616
+ sub = this.centrifuge.newSubscription(channel);
13617
+ sub.on('publication', function (ctx) {
13618
+ _this.resolveMessage(channel, ctx.data);
13619
+ });
13620
+ }
13617
13621
  sub.subscribe();
13618
13622
  return sub;
13619
13623
  };