Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApnsClient < Client
- def initialize(*args)
- @env = args[0].to_s
- end
- def post_init
- logger.info "connected to APNS #{@env.upcase} Push Server"
- end
- def connection_completed
- start_tls :private_key_file => "#{RAILS_ROOT}/lib/push/apns-#{@env}-key-noenc.pem",
- :cert_chain_file => "#{RAILS_ROOT}/lib/push/apns-#{@env}.pem"
- @host, @port = peer_host, peer_port
- logger.info "started TLS with APNS #{@env.upcase} Push Server at #{@host}:#{@port}"
- end
- def receive_data(data)
- # do nothing
- end
- def unbind
- logger.info "disconnected from APNS #{@env.upcase} Push Server"
- EM.add_timer(1) do
- logger.info "reconnecting to APNS #{@env.upcase} Push Server"
- reconnect(@host, @port)
- end
- end
- end
Add Comment
Please, Sign In to add comment