From 5f43b8540abdf1873debe315b71bf75acdf01801 Mon Sep 17 00:00:00 2001 From: Ritik Srivastava Date: Mon, 27 Dec 2021 10:07:22 +0530 Subject: [PATCH] Add isMobile query in setUpConnection --- src/lib/clients/Livechat.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/clients/Livechat.ts b/src/lib/clients/Livechat.ts index 863ae74f..5c8f5fbd 100644 --- a/src/lib/clients/Livechat.ts +++ b/src/lib/clients/Livechat.ts @@ -102,7 +102,9 @@ export default class LivechatClient extends LivechatRest implements ISocket { } async setUpConnection () { - const { token } = this.credentials - return (await this.socket as IDriver).methodCall('livechat:setUpConnection', { token }) + const { token } = this.credentials, + isMobile = !!window?.matchMedia('(max-width: 500px)')?.matches; + + return (await this.socket as IDriver).methodCall('livechat:setUpConnection', { token, isMobile }) } }