From 78fd7867181fa9678395ac749fdd5af34b7803bd Mon Sep 17 00:00:00 2001 From: Tom Sightler Date: Mon, 25 Nov 2024 10:45:43 -0500 Subject: [PATCH] Catch to prevent push-receiver crash on disconnect --- packages/ring-client-api/api.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/ring-client-api/api.ts b/packages/ring-client-api/api.ts index 88a4ceb6..319ef1ec 100644 --- a/packages/ring-client-api/api.ts +++ b/packages/ring-client-api/api.ts @@ -292,6 +292,15 @@ export class RingApi extends Subscribed { }), ) + pushReceiver.on('ON_DISCONNECT', () => { + pushReceiver.whenReady + .catch((e) => { + logError('Connection to the push notification server has failed unexpectedly') + logError('If this happens repeatedly, verify connections to TCP/5228 are allowed and that DNS Adblock rules allow gtalk.google.com') + logError(e.message) + }) + }) + try { await pushReceiver.connect() } catch (e) {