Guest User

Untitled

a guest
Jul 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. class ApnsClient < Client
  2. def initialize(*args)
  3. @env = args[0].to_s
  4. end
  5.  
  6. def post_init
  7. logger.info "connected to APNS #{@env.upcase} Push Server"
  8. end
  9.  
  10. def connection_completed
  11. start_tls :private_key_file => "#{RAILS_ROOT}/lib/push/apns-#{@env}-key-noenc.pem",
  12. :cert_chain_file => "#{RAILS_ROOT}/lib/push/apns-#{@env}.pem"
  13.  
  14. @host, @port = peer_host, peer_port
  15. logger.info "started TLS with APNS #{@env.upcase} Push Server at #{@host}:#{@port}"
  16. end
  17.  
  18. def receive_data(data)
  19. # do nothing
  20. end
  21.  
  22. def unbind
  23. logger.info "disconnected from APNS #{@env.upcase} Push Server"
  24.  
  25. EM.add_timer(1) do
  26. logger.info "reconnecting to APNS #{@env.upcase} Push Server"
  27. reconnect(@host, @port)
  28. end
  29. end
  30. end
Add Comment
Please, Sign In to add comment