Skip to content

Commit

Permalink
1223 return id for push api and stream init (#1226)
Browse files Browse the repository at this point in the history
* fix: added instanceids for push user and stream

* fix: review comments
  • Loading branch information
mohammeds1992 authored Apr 12, 2024
1 parent 34263c9 commit 9c0c28e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/restapi/src/lib/pushapi/PushAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class PushAPI {
// Notification
public channel!: Channel;
public notification!: Notification;
public pushUserInstanceId: string;
public uid: string;
// error object to maintain errors and warnings
public errors: { type: 'WARN' | 'ERROR'; message: string }[];

Expand All @@ -71,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.uid = uuidv4();
this.cache = cache;

// Initialize the instances of the four classes
Expand Down Expand Up @@ -315,7 +315,7 @@ export class PushAPI {
this.pgpPublicKey = newUser.publicKey;
this.readMode = false;
this.errors = [];

this.uid = uuidv4();
// Initialize the instances of the four classes
this.chat = new Chat(
this.account,
Expand Down
5 changes: 3 additions & 2 deletions packages/restapi/src/lib/pushstream/PushStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PushStream extends EventEmitter {
private chatInstance: Chat;
private listen: STREAM[];
private disconnected: boolean;
public streamInstanceId: string;
public uid: string;
constructor(
account: string,
private _listen: STREAM[],
Expand All @@ -45,7 +45,7 @@ export class PushStream extends EventEmitter {
this.options = options;
this.listen = _listen;
this.disconnected = false;
this.streamInstanceId = uuidv4();
this.uid = uuidv4();
this.chatInstance = new Chat(
this.account,
this.options.env as ENV,
Expand Down Expand Up @@ -102,6 +102,7 @@ export class PushStream extends EventEmitter {
listen: STREAM[],
newOptions: PushStreamInitializeProps
): Promise<void> {
this.uid = uuidv4();
this.listen = listen;
this.options = { ...this.options, ...newOptions };
await this.disconnect();
Expand Down

0 comments on commit 9c0c28e

Please sign in to comment.