From 29184457471ae378652b89fc7f276a22ea47a9e8 Mon Sep 17 00:00:00 2001 From: Mohammed S Date: Wed, 6 Nov 2024 13:14:49 +0530 Subject: [PATCH 1/2] fix: added logs --- packages/restapi/src/lib/pushstream/PushStream.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/restapi/src/lib/pushstream/PushStream.ts b/packages/restapi/src/lib/pushstream/PushStream.ts index 8cb8a7348..6e12e6900 100644 --- a/packages/restapi/src/lib/pushstream/PushStream.ts +++ b/packages/restapi/src/lib/pushstream/PushStream.ts @@ -168,6 +168,8 @@ export class PushStream extends EventEmitter { 'RestAPI::PushStream::connect - Emitted STREAM.CONNECT' ); resolve(); + } else { + console.log('RestAPI::PushStream::s-7'); } }; @@ -331,11 +333,14 @@ export class PushStream extends EventEmitter { }; if (this.pushChatSocket) { + console.log('RestAPI::PushStream::s-1'); this.pushChatSocket.off(EVENTS.CONNECT); this.pushChatSocket.on(EVENTS.CONNECT, async () => { + console.log('RestAPI::PushStream::s-2'); isChatSocketConnected = true; this.chatSocketCount++; this.chatSocketConnected = true; + console.log('RestAPI::PushStream::s-3'); checkAndEmitConnectEvent(); console.log( `RestAPI::PushStream::EVENTS.CONNECT::Chat Socket Connected (ID: ${this.pushChatSocket.id})` @@ -344,6 +349,7 @@ export class PushStream extends EventEmitter { this.pushChatSocket.off(EVENTS.DISCONNECT); this.pushChatSocket.on(EVENTS.DISCONNECT, async () => { + console.log('RestAPI::PushStream::s-4'); console.log( 'RestAPI::PushStream::ChatSocket::Disconnect - Chat socket disconnected.' ); @@ -502,6 +508,8 @@ export class PushStream extends EventEmitter { if (this.pushNotificationSocket) { this.pushNotificationSocket.off(EVENTS.CONNECT); this.pushNotificationSocket.on(EVENTS.CONNECT, async () => { + console.log('RestAPI::PushStream::s-5'); + console.log( `RestAPI::PushStream::NotifSocket::Connect - Notification Socket Connected (ID: ${this.pushNotificationSocket.id})` ); @@ -513,6 +521,8 @@ export class PushStream extends EventEmitter { this.pushNotificationSocket.off(EVENTS.DISCONNECT); this.pushNotificationSocket.on(EVENTS.DISCONNECT, async () => { + console.log('RestAPI::PushStream::s-6'); + console.log( 'RestAPI::PushStream::NotifSocket::Disconnect - Notification socket disconnected.' ); From 7f6dd8cb003f1a61df375dcda1939f73166985a8 Mon Sep 17 00:00:00 2001 From: Mohammed S Date: Wed, 6 Nov 2024 14:11:53 +0530 Subject: [PATCH 2/2] fix: stream fix --- packages/restapi/src/lib/pushstream/PushStream.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/restapi/src/lib/pushstream/PushStream.ts b/packages/restapi/src/lib/pushstream/PushStream.ts index 6e12e6900..8a7012301 100644 --- a/packages/restapi/src/lib/pushstream/PushStream.ts +++ b/packages/restapi/src/lib/pushstream/PushStream.ts @@ -334,6 +334,7 @@ export class PushStream extends EventEmitter { if (this.pushChatSocket) { console.log('RestAPI::PushStream::s-1'); + checkAndEmitConnectEvent(); this.pushChatSocket.off(EVENTS.CONNECT); this.pushChatSocket.on(EVENTS.CONNECT, async () => { console.log('RestAPI::PushStream::s-2'); @@ -506,6 +507,8 @@ export class PushStream extends EventEmitter { } if (this.pushNotificationSocket) { + checkAndEmitConnectEvent(); + console.log('RestAPI::PushStream::s-4.9'); this.pushNotificationSocket.off(EVENTS.CONNECT); this.pushNotificationSocket.on(EVENTS.CONNECT, async () => { console.log('RestAPI::PushStream::s-5'); @@ -637,10 +640,10 @@ export class PushStream extends EventEmitter { } } - public info() { + public info(): { options: PushStreamInitializeProps; listen: STREAM[] } { return { options: this.options, - listen: this.listen, + listen: this.listen as STREAM[], }; }