Module: Webpush

Defined in:
lib/webpush.rb,
lib/webpush/version.rb

Constant Summary collapse

GCM_URL =

It is temporary URL until supported by the GCM server.

'https://android.googleapis.com/gcm/send'
TEMP_GCM_URL =
'https://gcm-http.googleapis.com/gcm'
VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.payload_send(message:, endpoint:, p256dh:, auth:, api_key:) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/webpush.rb', line 15

def payload_send(message:, endpoint:, p256dh:, auth:, api_key:)
  endpoint = endpoint.gsub(GCM_URL, TEMP_GCM_URL)
  p256dh = unescape_base64(p256dh)
  auth = unescape_base64(auth)

  payload = encrypt(message, p256dh, auth)
  gcm_post(endpoint, payload, api_key)
end