Skip to content

Instantly share code, notes, and snippets.

@naumov
Last active March 12, 2017 21:40
Show Gist options
  • Save naumov/b7a0a320336c3d396ce5cffcbcf42c1e to your computer and use it in GitHub Desktop.
Save naumov/b7a0a320336c3d396ce5cffcbcf42c1e to your computer and use it in GitHub Desktop.
rpush apns 2 http/2 example
app = Rpush::Apns2::App.new
app.name = "ios_app"
app.certificate = File.read("/path/to/cert/cert.pem")
app.environment = "production"
app.connections = 1
app.save!
Rpush.embed # to deliver in console on notification save
n = Rpush::Apns2::Notification.new
n.app = app
n.alert = "hello"
n.device_token = "TOKEN" # replace TOKEN with ios device token
n.data = {'headers' => { 'apns-topic' => "com.ios.app" }} # replace com.ios.app with ios app bundle id
n.save!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment