Maybe there are other questions answered around this, but I cannot seem to be able to solve my problem.
I am trying to use the Apple Push Notification Service as a Provider, using ruby 2.2.3.
I have tried a series of gems that I found and they all have the same problem. The gems that I have tried are:
They all raise the same exception:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A
These gems are using OpenSSL to create an SSL connection to APNS end point. But they fail to do that.
Please, note that I am working on a Mac OS X Yosemite machine.
Any help?
EDIT More info on how I use grocer
:
pusher = Grocer.pusher(
certificate: "/Users/panayotismatsinopoulos/Documents/ProgrammingSwift/certificate.pem",
passphrase: "the passphrase for loading certificate",
gateway: "gateway.sandbox.push.apple.com",
port: 2195,
retries: 3
)
notification = Grocer::Notification.new(
device_token: "....the device token here...",
alert: "Hello There!",
badge: 42)
pusher.push(notification)
And the exception I get is:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:29:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:55:in `with_connection'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:23:in `write'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/grocer-0.6.1/lib/grocer/pusher.rb:8:in `push'
from (irb):29
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3@my_project/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Finally, I realised that I was using wrong .pem
file. It was not the one specific for the Mobile app that I was trying to push notifications to.
It was the .pem
file corresponding to signing certificate to sign my code.
As soon as I used the correct .pem
file, everything went smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With