From 34263c94ccfe674f915ce318a60cc21a77a0a5de Mon Sep 17 00:00:00 2001 From: Mohammed S Date: Fri, 12 Apr 2024 16:56:05 +0530 Subject: [PATCH] fix: added instanceids for push user and stream (#1224) --- packages/restapi/src/lib/pushapi/PushAPI.ts | 5 +++-- packages/restapi/src/lib/pushstream/PushStream.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/restapi/src/lib/pushapi/PushAPI.ts b/packages/restapi/src/lib/pushapi/PushAPI.ts index 577754196..29675894b 100644 --- a/packages/restapi/src/lib/pushapi/PushAPI.ts +++ b/packages/restapi/src/lib/pushapi/PushAPI.ts @@ -21,6 +21,7 @@ import { Video } from './video'; import { isValidCAIP10NFTAddress } from '../helpers'; import { LRUCache } from 'lru-cache'; import { cache } from '../helpers/cache'; +import { v4 as uuidv4 } from 'uuid'; export class PushAPI { private signer?: SignerType; @@ -44,7 +45,7 @@ export class PushAPI { // Notification public channel!: Channel; public notification!: Notification; - + public pushUserInstanceId: string; // error object to maintain errors and warnings public errors: { type: 'WARN' | 'ERROR'; message: string }[]; @@ -70,7 +71,7 @@ export class PushAPI { // Instantiate the notification classes this.channel = new Channel(this.signer, this.env, this.account); this.notification = new Notification(this.signer, this.env, this.account); - + this.pushUserInstanceId = uuidv4(); this.cache = cache; // Initialize the instances of the four classes diff --git a/packages/restapi/src/lib/pushstream/PushStream.ts b/packages/restapi/src/lib/pushstream/PushStream.ts index 92edcff5e..988ecab80 100644 --- a/packages/restapi/src/lib/pushstream/PushStream.ts +++ b/packages/restapi/src/lib/pushstream/PushStream.ts @@ -17,7 +17,7 @@ import { Chat } from '../pushapi/chat'; import { ProgressHookType, SignerType } from '../types'; import { ALPHA_FEATURE_CONFIG } from '../config'; import { ADDITIONAL_META_TYPE } from '../payloads'; - +import { v4 as uuidv4 } from 'uuid'; export class PushStream extends EventEmitter { private pushChatSocket: any; private pushNotificationSocket: any; @@ -28,7 +28,7 @@ export class PushStream extends EventEmitter { private chatInstance: Chat; private listen: STREAM[]; private disconnected: boolean; - + public streamInstanceId: string; constructor( account: string, private _listen: STREAM[], @@ -45,6 +45,7 @@ export class PushStream extends EventEmitter { this.options = options; this.listen = _listen; this.disconnected = false; + this.streamInstanceId = uuidv4(); this.chatInstance = new Chat( this.account, this.options.env as ENV,