Module: ApnServer::Protocol
- Included in:
- ServerConnection
- Defined in:
- lib/apnserver/protocol.rb
Instance Method Summary collapse
Instance Method Details
#post_init ⇒ Object
4 5 6 7 |
# File 'lib/apnserver/protocol.rb', line 4 def post_init @address = Socket.unpack_sockaddr_in(self.get_peername) puts "#{Time.now} [#{address.last}:#{address.first}] CONNECT" end |
#receive_data(data) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/apnserver/protocol.rb', line 13 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 |
#unbind ⇒ Object
9 10 11 |
# File 'lib/apnserver/protocol.rb', line 9 def unbind puts "#{Time.now} [#{address.last}:#{address.first}] DISCONNECT" end |