Sha256: 79b42a2ca947d575151ef2f47a1c202f9b81c6fadc8747045ee61bff08d25a43

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

module ApnServer
  module Protocol
    
    def post_init
      @address = Socket.unpack_sockaddr_in(self.get_peername)
      puts "#{Time.now} [#{address.last}:#{address.first}] CONNECT"
    end
    
    def unbind
      puts "#{Time.now} [#{address.last}:#{address.first}] DISCONNECT"    
    end
    
    def receive_data(data)
      (@buf ||= "") << data
      if notification = ApnServer::Notification.valid?(@buf)
        puts "#{Time.now} [#{address.last}:#{address.first}] found valid Notification: #{notification}"
        queue.push(notification)
      else
        puts "#{Time.now} [#{address.last}:#{address.first}] invalid notification: #{@buf}"
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apnserver-0.1.10 lib/apnserver/protocol.rb
apnserver-0.1.9 lib/apnserver/protocol.rb