Sha256: 6b3e265e3f671c78378eedd767aecb1a9a19e661125336c584ff75b89459998c

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

# Racoon - A distributed APNs provider
# Copyright (c) 2011, Jeremy Tregunna, All Rights Reserved.
#
# This module contains the code that connects to the feedback service.

module Racoon
  module APNS
    class FeedbackConnection < Connection
      def initialize(pem, host = 'feedback.push.apple.com', port = 2196, pass = nil)
        @pem, @host, @port, @pass = pem, host, port, pass
      end

      def read
        records ||= []
        while record = @ssl.read(38)
          records << parse_tuple(record)
        end
        records
      end

      private

      def parse_tuple(data)
        feedback = data.unpack("N1n1H*")
        { :feedback_at => Time.at(feedback[0]), :length => feedback[1], :device_token => feedback[2] }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
racoon-1.0.1 lib/racoon/apns/feedback_connection.rb
racoon-1.0.0 lib/racoon/apns/feedback_connection.rb
racoon-0.6.0 lib/racoon/apns/feedback_connection.rb
racoon-0.5.0 lib/racoon/apns/feedback_connection.rb