Tag: apple push notifications

什么原因导致在ruby中构建公钥时“PUB键和PRIV键都没有嵌套asn1错误”?

使用OpenSSL :: PKey :: RSA模块通过传递.pem文件构建公钥时,响应的原因是什么: OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error from /Users/Matt/projects/placepop/lib/apn.rb:48:in `initialize’ from /Users/Matt/projects/placepop/lib/apn.rb:48:in `new’ from /Users/Matt/projects/placepop/lib/apn.rb:48:in `open’ from (irb):1 这是来源: cert = File.join(rails_root, ‘config’, ‘apns’, ‘sandbox-cert.pem’) APN_CONFIG = { :delivery => { :host => ‘gateway.sandbox.push.apple.com’, :cert => cert, :passphrase => “”, :port => 2195 }, :feedback => { […]

Erlang中的Apple推送通知(或Ruby中的改进?)

我目前在Ruby服务器上运行Apple推送通知。 我想让一个人去Erlang,因为我想用一个主管来监视它。 有没有人有他们可以帮助我的代码? 这是我的Ruby代码。 我不喜欢这个当前实现的一件事是它似乎没有保持连接 – 它每天断开连接2-3次,而且在我重新连接之后,第一次推送似乎不会通过: context = OpenSSL::SSL::SSLContext.new context.cert = OpenSSL::X509::Certificate.new(File.read(cert)) context.key = OpenSSL::PKey::RSA.new(File.read(cert)) def connect_sockets(server, context) sock = TCPSocket.new(server, 2195) ssl = OpenSSL::SSL::SSLSocket.new(sock,context) ssl.connect return sock, ssl end sock, ssl = connect_sockets(server, context) # this is called to initially connect and also reconnect whenever disconnected. 如果Erlang Push不可行,那么我不介意坚持我的Ruby,只要我可以保持我的连接活着,并且可能通过Erlang监督它。 有谁知道这是否可能?