@hivegpt/hiveai-angular 0.0.161 → 0.0.163

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.
@@ -564,7 +564,18 @@
564
564
  var NotificationSocket = /** @class */ (function (_super) {
565
565
  __extends(NotificationSocket, _super);
566
566
  function NotificationSocket() {
567
- return _super.call(this, socketConfig) || this;
567
+ var _this = _super.call(this, socketConfig) || this;
568
+ // Log connection status
569
+ _this.on('connect', function () {
570
+ console.log('Socket connected');
571
+ });
572
+ _this.on('disconnect', function () {
573
+ console.warn('Socket disconnected');
574
+ });
575
+ _this.on('connect_error', function (err) {
576
+ console.error('Socket connection error:', err);
577
+ });
578
+ return _this;
568
579
  }
569
580
  return NotificationSocket;
570
581
  }(ngxSocketIo.Socket));
@@ -611,13 +622,22 @@
611
622
  };
612
623
  SocketService.prototype.registerUserSpecificHiveSocket = function (botId, conversation_id) {
613
624
  var _this = this;
625
+ // Ensure socket is connected before emitting events
626
+ // if (!this.notificationSocket.con) {
627
+ // console.warn('Socket is not connected, cannot register user-specific socket.');
628
+ // return;
629
+ // }
630
+ console.log('Registering user-specific Hive socket with botId:', botId, 'and conversation_id:', conversation_id);
614
631
  this.notificationSocket.emit('joinData', {
615
632
  groupId: "Hive_AI_Notifs_" + botId + "_" + conversation_id,
616
633
  });
617
634
  this.notificationSocket
618
635
  .fromEvent('commonNotification')
619
636
  .subscribe(function (res) {
637
+ console.log('Received commonNotification:', res);
620
638
  _this.conversationService.sendValidatedUserData(res);
639
+ }, function (error) {
640
+ console.error('Error receiving commonNotification:', error);
621
641
  });
622
642
  };
623
643
  SocketService.prototype.startReleasingMessages = function () {
@@ -626,6 +646,8 @@
626
646
  setInterval(function () {
627
647
  if (_this.messageQueue.length > 0) {
628
648
  var message = _this.messageQueue.shift(); // Remove the first message from the queue
649
+ // Handle the message here, e.g., send it to the server or process it
650
+ console.log('Releasing message from queue:', message);
629
651
  // this.campaignService.sendValidatedUserData(message);
630
652
  }
631
653
  }, this.releaseInterval);
@@ -783,7 +805,8 @@
783
805
  }, 200);
784
806
  };
785
807
  ChatDrawerComponent.prototype.initializeSocket = function () {
786
- this.socketService.registerUserSpecificHiveSocket(this.botId, this.conversationKey);
808
+ console.log("Socket connection");
809
+ this.socketService.registerUserSpecificHiveSocket(this.botId, this.conversation.getKey(this.botId));
787
810
  };
788
811
  ChatDrawerComponent.prototype.listenSockets = function () {
789
812
  var _this = this;