On using an open upstream socket to send multiple notifications as follows (using my own tokens)
# Initialize some notifications
notification1 = APND::Notification.new(
:alert => 'Alert!',
:token => 'fe15a27d5df3c34778defb1f4f3880265cc52c0c047682223be59fb68500a9a2',
:badge => 1
)
notification2 = APND::Notification.new(
:alert => 'Red Alert!',
:token => '55711f0b3493d48abe829fe0f94f0829086335418e96d041ed62c5c7681904b4',
:badge => 99
)
# Send multiple notifications at once to avoid overhead in
# opening/closing the upstream socket connection each time
APND::Notification.open_upstream_socket do |sock|
sock.write(notification1.to_bytes)
sock.write(notification2.to_bytes)
end
[2011-02-17 23:46:41] Queue has 2 items
[2011-02-17 23:46:42] Sending notification for fe15a27d5df3c34778defb1f4f3880265cc52c0c047682223be59fb68500a9a2
[2011-02-17 23:46:42] Sending notification for fe15a27d5df3c34778defb1f4f3880265cc52c0c047682223be59fb68500a9a2
I think this may be a bug but please let me know if there is something wrong with syntax. Thanks.