Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module APNS
- def self.send_notifications(notifications)
- sock, ssl = self.open_connection
- notifications.each do |n|
- ssl.write(self.packaged_notification(n[0], n[1]))
- end
- ssl.close
- sock.close
- end
- end
- # usage
- notification1 = ['1234-12314-123123-123123', 'Hello Hello']
- notification2 = ['1234-12314-123123-123123', {:alert => 'Hello iPhone!', :badge => 1, :sound => 'default'}]
- notifications = [notification1, notification2]
- APNS.send_notifications(notifications)
Add Comment
Please, Sign In to add comment