Coder Social home page Coder Social logo

apnd's Introduction

Hello there ๐Ÿ‘‹

I'm Josh. I lead the Software Development team at A2 Hosting where we're building tools for WordPress web professionals. I write a bit over at josh.fail and I hack a bit here on GitHub.

apnd's People

Contributors

itspriddle avatar mwotton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

apnd's Issues

submitted invalid Notification

I am on an ubuntu machine with rails 2.3.8, and the apnd gem 0.1.6.

Notifications are sent beautifully when I see APND::Notification.create or use apnd-push -- i.e. one at a time. However, when I try to do this -

notification1 = APND::Notification.new(
:alert => 'Red Alert!',
:token => 'My Token,
:badge => 99
)

APND::Notification.open_upstream_socket do |sock|
sock.puts notification1
end

I see this in the log

[2011-02-17 05:29:56] Queue has 1 item
[2011-02-17 05:29:56] Sending notification for 'My Token'
[2011-02-17 05:36:46] 127.0.0.1:55122 opened connection
[2011-02-17 05:36:46] 127.0.0.1:55122 submitted invalid Notification
[2011-02-17 05:36:46] 127.0.0.1:55122 closed connection

and the notification doesn't go through.

Any help will be appreciated. Thanks.

Sending Push Notification to Invalid Device ID Breaks All Following Notifications

Here is the usual upstream socket code

socket = APND::Notification.open_upstream_socket do |sock|
      users.each do |user|
        notification = APND::Notification.new(
                              :token  => user.iphone_device_id,
                              :badge  => user.unread_count
                              )
        puts notification.token
        sock.puts(notification.to_bytes + "\n")
      end
 end

If one of the iphone device ids is invalid (user deleted the app etc.) notifications are skipped for all the following iphone device ids.

This happens even if I use this code

    users.each do |user|
      APND::Notification.create(
                          :token  => user.iphone_device_id,
                          :badge  => user.unread_count
                          )
    end

As always, your help will be really appreciated.

hard dependency on daemons 1.1.0

Just wondering if there a serious requirement to have a dependency on daemons version 1.1.0
My app uses thin which has defined the dependency on daemons to be >= 1.1.4
This makes bundler install apnd version 0.1.0 which is kinda old.

open_upstream_socket multiple notifications bug

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

The apnd log shows the notification being sent to the first device id twice

[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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.