在二郎山苹果推送通知(或Ruby的改进?) [英] Apple Push Notification in Erlang (or improved in Ruby?)

查看:137
本文介绍了在二郎山苹果推送通知(或Ruby的改进?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有我的Ruby的服务器上运行的苹果推送通知。我想获得在二郎山1正在进行,我想用一个上司照顾好它。没有人有任何code,他们可以帮助我?

I currently have an Apple Push Notification running on my server in Ruby. I'd like to get one going in Erlang as I'd like to use a supervisor to keep watch over it. Does anyone have any code that they could help me with?

下面是我的红宝石code。有一件事我不喜欢这个目前执行的是,它似乎并没有保持联系 - 它断开,每日2-3次,似乎后,我重新连接的第一个推不会通过:

Here's my Ruby code. One thing I do not like about this current implementation is that it does not seem to stay connected - it disconnects 2-3 times a day, and it seems after I reconnect that the first push will not go through:

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.

如果二郎推送是不可行的话,我不会介意,只要我能保持我的连接还活着,也许通过二郎监督它坚持我的红宝石之一。有谁知道任何这是可能的吗?

If Erlang Push isn't doable then I wouldn't mind sticking to my Ruby one as long as I can keep my connections alive, and perhaps supervise it through Erlang. Does anyone know if any of this is possible?

推荐答案

这<一个href=\"http://stackoverflow.com/questions/1757171/how-to-send-a-push-notification-using-erlang\">question苹果推使用Erlang通知也可能是这一个很有用的。

This question on Apple Push Notifications with Erlang might also be useful for this one.

这篇关于在二郎山苹果推送通知(或Ruby的改进?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆