Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Trying Rapns with Safari Push #185

Closed
masterkain opened this Issue · 10 comments

3 participants

@masterkain

I implemented packaging, signing and callbacks functionality in my web app to enable Safari Push notification, now it's time to start testing if the whole thing works with rapns, however the tokens released by Safari are not compatible with the ones that currently rapns accepts on notifications.

Do you think it's possible for rapns to support Safari Push notification and if yes are you interested in pull requests?

@masterkain

Everything appears to be working, it's just the token validation that needs fixing, and mention that perhaps Safari Push message can be sent only in production (as per Apple guidelines).

To send an acceptable payload:

    notification.attributes_for_device = {
      aps: {
        alert: {
          title: title,
          body: body,
          action: 'View'
        },
        'url-args' => ['boarding']
      }
    }
@masterkain

still checking, will do a pull request with further findings.

@masterkain masterkain closed this
@mattconnolly

I haven't looked into Safari web push yet. What do the tokens look like that they fail?

@mattconnolly

Pull requests always welcome!

@masterkain

I got tokens back such as 078069A9EE1522D7C05DB462936D20E6E450ED7DE1A79FCFDE671CE3020688D3, which are same length but the regex /^[a-z0-9]{64}$/i does not match them.

@masterkain

two other things:

  • as per the spec "url-args": ["boarding", "A998"] seems optional, while it is really not.
  • the spec is unclear on the token format, maybe you have better luck

spec is here: https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW1

@mattconnolly

The token you have there matches the regex you have (not looking at code yet). I think the regex should be /^[0-9a-f]{64}$/i though.

@masterkain

you're right, I forgot the /i in the tests I made, however I have a validation exception while trying to send notification with the safari push token, digging further.

@masterkain

ok, it works without modification, it must have been something else that got in the way.
nothing to do :+1:

@ileitch
Owner

I'd love to see a Wiki page for Safari Push ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.