Ruby 为什么在尝试连接到Apple推送通知服务时会出现OpenSSL错误?
也许还有其他问题可以回答,但我似乎无法解决我的问题 我正在尝试使用Apple推送通知服务作为提供者,使用ruby 2.2.3 我试过一系列我发现的宝石,它们都有同样的问题。我尝试过的宝石有: 他们都提出了同样的例外:Ruby 为什么在尝试连接到Apple推送通知服务时会出现OpenSSL错误?,ruby,openssl,apple-push-notifications,Ruby,Openssl,Apple Push Notifications,也许还有其他问题可以回答,但我似乎无法解决我的问题 我正在尝试使用Apple推送通知服务作为提供者,使用ruby 2.2.3 我试过一系列我发现的宝石,它们都有同样的问题。我尝试过的宝石有: 他们都提出了同样的例外: OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A 这些gem使用OpenSSL创建到APNS端点的SSL连接。但他们
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A
这些gem使用OpenSSL创建到APNS端点的SSL连接。但他们没有做到这一点
请注意,我正在使用Mac OS X Yosemite机器
有什么帮助吗
编辑有关如何使用杂货商的更多信息
:
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)
我得到的例外是:
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>'
OpenSSL::SSL::SSLError:SSL\u connect SYSCALL返回=5 errno=0 state=SSLv3读取服务器会话票证A
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in'connect'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in'connect'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:29:in'connect'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:55:in“with_connection”
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:23:in'write'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/grocer-0.6.1/lib/grocer/pusher.rb:8:in'push'
来自(irb):29
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in'start'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in'start'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in'console'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/railties-4.2.4/lib/rails/commands/commands\u tasks.rb:39:in'run\u command!'
来自/Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2。3@my_project/gems/railties-4.2.4/lib/rails/commands.rb:17:in`'
从箱子/轨道:4:in“require”
从箱子/轨道:4:in`'
最后,我意识到我使用了错误的.pem
文件。这并不是我试图将通知推送到的移动应用程序的特定版本。
这是签名证书对应的.pem
文件,用于签名我的代码
我一使用正确的
.pem
文件,一切都很顺利。您是否使用证书连接到APNS?你能为grocer提供配置示例吗?@andrykonchin我已经更新了问题的内容,说明我是如何使用grocer
发送通知的。我从未遇到过此类错误,但他们说旧版本的OpenSSL可能是原因(),你能检查OpenSSL版本
(但我使用OpenSSL 0.9.8za并从Mavericks成功连接APN)@andrykonchin设备令牌格式可能有问题吗?当使用grocer
时,您如何对设备令牌进行编码。我知道Apple返回的设备令牌是二进制数据。我需要在那里发送一个字节数组。否?我想-否,当令牌错误时,ruby客户端会发送通知,但通知不会返回iOS开发人员将令牌视为
,ruby客户端必须将其作为字母数字序列发送,不带空格(33af510967918778a1f91c2af67ade5aee8e3a8a
)