Skip to content

Commit

Permalink
Catch to prevent push-receiver crash on disconnect (#1540)
Browse files Browse the repository at this point in the history
* Catch to prevent push-receiver crash on disconnect

* Add changeset

---------

Co-authored-by: Tom Sightler <[email protected]>
Co-authored-by: dgreif <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 68643f5 commit 06a3bcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/shy-needles-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'homebridge-ring': patch
'ring-client-api': patch
---

Handle errors when connecting to push notification service
11 changes: 11 additions & 0 deletions packages/ring-client-api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ 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()
Expand Down

0 comments on commit 06a3bcb

Please sign in to comment.