Skip to content

Commit a480048

Browse files
tsightlerTom Sightlerdgreif
committed
Catch to prevent push-receiver crash on disconnect (#1540)
* Catch to prevent push-receiver crash on disconnect * Add changeset --------- Co-authored-by: Tom Sightler <[email protected]> Co-authored-by: dgreif <[email protected]>
1 parent 9ffb741 commit a480048

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.changeset/shy-needles-stare.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'homebridge-ring': patch
3+
'ring-client-api': patch
4+
---
5+
6+
Handle errors when connecting to push notification service

packages/ring-client-api/api.ts

+12
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ export class RingApi extends Subscribed {
292292
}),
293293
)
294294

295+
pushReceiver.on('ON_DISCONNECT', () => {
296+
pushReceiver.whenReady.catch((e) => {
297+
logError(
298+
'Connection to the push notification server has failed unexpectedly',
299+
)
300+
logError(
301+
'If this happens repeatedly, verify connections to TCP/5228 are not blocked by firewall or IDS/IPS policies, and that DNS Adblock rules allow mtalk.google.com',
302+
)
303+
logError(e.message)
304+
})
305+
})
306+
295307
try {
296308
await pushReceiver.connect()
297309
} catch (e) {

0 commit comments

Comments
 (0)