Erlang Apple Push notification (or improved in Ruby?)

I currently have an Apple Push Notification running on my server in Ruby. I would like me to go to Erlang because I would like to use a supervisor to keep track of him. Does anyone have a code with which they could help?

Here is my Ruby code. One thing I don’t like about this current implementation is that it doesn’t seem to be in touch - it disconnects 2-3 times a day, and it seems that after I reconnect, the first pressing will not work:

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 is not feasible, I would not mind sticking to my Ruby as long as I can keep my contacts alive and possibly control it through Erlang. Does anyone know if this is possible?

+4
source share
3 answers

This Apple Push Notifications question with Erlang may also be helpful for this.

+2
source

The HTTP client (with SSL support) that comes with Erlang works quite well (I can't say I tested the battle). Relevant documentation is available here .

1) Remember to execute "inets: start ()" in your application before trying to make HTTP calls.

2) In my (small) experience, starting the "inets" module seems a bit complicated: do not try to run it in your dispatcher module, otherwise your servers will not work. I usually do "inets: start ()" in the first server module of my application before other servers that require HTTP are available.

3) To perform the push operation, I think you will need to use the stream option.

0
source

You can also check apn_on_rails project.

If you come up with an Erlang implementation, consider sharing it with us :).

0
source

All Articles