From d523bf8981324634e18f19667f09c923766515b8 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sat, 20 Nov 2021 17:20:06 +0530 Subject: [PATCH] feat: detect when multi-device beta not joined --- src/Socket/socket.ts | 5 +++++ src/Types/index.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index a3b4f1d..45323d7 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -524,6 +524,11 @@ export const makeSocket = ({ const reason = +(node.attrs.reason || 500) end(new Boom('Connection Failure', { statusCode: reason, data: node.attrs })) }) + + ws.on('CB:ib,,downgrade_webclient', () => { + end(new Boom('Multi-device beta not joined', { statusCode: DisconnectReason.notJoinedBeta })) + }) + process.nextTick(() => { ev.emit('connection.update', { connection: 'connecting', receivedPendingNotifications: false, qr: undefined }) }) diff --git a/src/Types/index.ts b/src/Types/index.ts index 1c69c2d..6eca814 100644 --- a/src/Types/index.ts +++ b/src/Types/index.ts @@ -60,7 +60,8 @@ export enum DisconnectReason { timedOut = 408, loggedOut = 401, badSession = 500, - restartRequired = 410 + restartRequired = 410, + notJoinedBeta = 403 } export type WAInitResponse = {