From f7b723f97b4501574938499847663efddff06d6d Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 4 Jul 2022 16:52:38 +0530 Subject: [PATCH] feat: fire "receivedPendingNotifications" after flush --- src/Socket/messages-recv.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index ac03a14..9eabfa8 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -537,13 +537,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { } // called when all offline notifs are handled - ws.on('CB:ib,,offline', (node: BinaryNode) => { + ws.on('CB:ib,,offline', async(node: BinaryNode) => { const child = getBinaryNodeChild(node, 'offline') const offlineNotifs = +child.attrs.count logger.info(`handled ${offlineNotifs} offline messages/notifications`) + await ev.flush() ev.emit('connection.update', { receivedPendingNotifications: true }) - ev.flush() }) // recv a message