chore: Switch to web-push gem (#6390)

- The previous gem, `webpush` was last updated a while ago. Also, with the recent ruby upgrade, we needed a fix for zaru/webpush#106. Hence switching to the `web-push` gem where the issues are fixed.
This commit is contained in:
Sojan Jose
2023-02-03 18:55:22 +05:30
committed by GitHub
parent 46eeee7d92
commit 38aee8d9ea
5 changed files with 15 additions and 24 deletions

View File

@@ -49,7 +49,7 @@ class Notification::PushNotificationService
def send_browser_push(subscription)
return unless send_browser_push?(subscription)
Webpush.payload_send(
WebPush.payload_send(
message: JSON.generate(push_message),
endpoint: subscription.subscription_attributes['endpoint'],
p256dh: subscription.subscription_attributes['p256dh'],
@@ -63,10 +63,10 @@ class Notification::PushNotificationService
open_timeout: 5,
read_timeout: 5
)
rescue Webpush::ExpiredSubscription
rescue WebPush::ExpiredSubscription
subscription.destroy!
rescue Errno::ECONNRESET, Net::OpenTimeout, Net::ReadTimeout => e
Rails.logger.error "Webpush operation error: #{e.message}"
Rails.logger.error "WebPush operation error: #{e.message}"
end
def send_fcm_push(subscription)