diff --git a/packages/restapi/src/lib/pushstream/PushStream.ts b/packages/restapi/src/lib/pushstream/PushStream.ts index 949efa4ef..3b944a884 100644 --- a/packages/restapi/src/lib/pushstream/PushStream.ts +++ b/packages/restapi/src/lib/pushstream/PushStream.ts @@ -160,7 +160,7 @@ export class PushStream extends EventEmitter { if (shouldInitializeChatSocket) { if (!this.pushChatSocket) { // If pushChatSocket does not exist, create a new socket connection - this.pushChatSocket = createSocketConnection({ + this.pushChatSocket = await createSocketConnection({ user: walletToPCAIP10(this.account), socketType: 'chat', socketOptions: { @@ -186,7 +186,7 @@ export class PushStream extends EventEmitter { if (shouldInitializeNotifSocket) { if (!this.pushNotificationSocket) { // If pushNotificationSocket does not exist, create a new socket connection - this.pushNotificationSocket = createSocketConnection({ + this.pushNotificationSocket = await createSocketConnection({ user: pCAIP10ToWallet(this.account), env: this.options?.env as ENV, socketOptions: { diff --git a/packages/restapi/src/lib/pushstream/socketClient.ts b/packages/restapi/src/lib/pushstream/socketClient.ts index 0cd68ba32..568dfe696 100644 --- a/packages/restapi/src/lib/pushstream/socketClient.ts +++ b/packages/restapi/src/lib/pushstream/socketClient.ts @@ -3,7 +3,7 @@ import { API_BASE_URL } from '../config'; import { getCAIPAddress, walletToPCAIP10 } from '../helpers'; import { SocketInputOptions } from './pushStreamTypes'; -export function createSocketConnection({ +export async function createSocketConnection({ user, env, socketType = 'notification', @@ -29,7 +29,7 @@ export function createSocketConnection({ const userAddressInCAIP = socketType === 'chat' ? walletToPCAIP10(user) - : getCAIPAddress(env, user, 'User'); + : await getCAIPAddress(env, user, 'User'); const query = socketType === 'notification'