Git Product home page Git Product logo

ruby-push-notifications's Introduction

Ruby Push Notifications

Build Status Dependency Status Code Climate Test Coverage Gem Version Join the chat at https://gitter.im/calonso/ruby-push-notifications

iOS, Android and Windows Phone Push Notifications made easy!

Features

  • iOS and Android support
  • Complete error and retry management
  • Easy and intuitive API

Installation

Add this line to your application's Gemfile:

gem 'ruby-push-notifications'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby-push-notifications

Usage

Ruby Push Notifications gem usage is really easy.

  1. After installing, require the gem
  2. Create one or more notifications
  3. Create the corresponding pusher
  4. Push!!
  5. Get feedback

For completely detailed examples:

  1. Apple iOS example
  2. Google Android example (GCM)
  3. Google Android example (FCM)
  4. Windows Phone(MPNS) example
  5. Windows Phone(WNS) example

Pending tasks

Feel free to contribute!!

  • Validate iOS notifications format and max size
  • Validate iOS tokens format
  • Validate GCM registration ids format
  • Validate GCM notifications format and max size
  • Split GCM notifications in parts if more than 1000 destinations are given (currently raising exception)
  • Integrate with APNS Feedback service
  • Validate MPNS notifications format
  • Validate MPNS data
  • Add other platforms (Amazon Fire...)

Contributing

  1. Fork it ( https://github.com/calonso/ruby-push-notifications/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Troubleshooting

If you see "255 Unknown Error" error code

This error code is assigned when the connection to push notification server wasn't successful 255 UNKnown Error code

Checking your connection configuration for example with APNS connection. When your pem file and token are development make sure you configure the pusher for sandbox mode RubyPushNotifications::APNS::APNSPusher.new('the certificate', true))

or when your pem file and token are production you should configure the pusher for production mode (Set the sandbox mode to false when creating your pusher) RubyPushNotifications::APNS::APNSPusher.new('the certificate', false))

Changelog

Refer to the CHANGELOG.md file for detailed changes across versions.

ruby-push-notifications's People

Contributors

bryant1410 avatar calonso avatar juksefantomet avatar krim avatar lazaronixon avatar trimentor avatar waqar-baig avatar

Stargazers

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

Watchers

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

ruby-push-notifications's Issues

I got "Error message individual_results => 255" for ios push notification

Everything is ok for me when I tested in local and staging.

Until today I just pushed it to PROD I got error message about individual_results => 255 when I sent one device token. and I got below error when I sent more than one device tokens

NoMethodError: undefined method `unpack' for nil:NilClass

from /app/vendor/bundle/ruby/2.2.0/gems/ruby-push-notifications-0.3.1/lib/ruby-push-notifications/apns/apns_pusher.rb:59:in `push' from (irb):14

from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'

from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'

from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'

from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'

from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'

from /app/bin/rails:8:in `require'

from /app/bin/rails:8:in `<main>'

I tested about pem file and device token they're correct.

Please help me Thank you so much.

Change Android example

In the GCM example the notification is created with:

{ text: "Hello GCM world" }

But it should be:

{ message: "Hello GCM world" }

getaddrinfo: nodename nor servname provided, or not known (SocketError)

The host url that I'm requesting is https://api.push.apple.com/....
The actual url is the push token appended to the above url:

Therefore the actual url becomes https://api.push.apple.com/..../<push_token> which is uri

notification = RubyPushNotifications::APNS::APNSNotification.new tokens, { aps: { alert: 'Hello APNS World!', sound: 'true', badge: 1 } }

pusher = RubyPushNotifications::APNS::APNSPusher.new(File.read('Certificates.pem'), true, password, { host: uri })

On pusher.push [notification] I get getaddrinfo: nodename nor servname provided, or not known (SocketError).

The uri works perfectly via curl.

require "Forwardable"

Hi, I've recently downloaded this gem, and I had an issue where I had to go inside the gem and add a γ€Šrequire "Forwardable"》or the gem would prevent my program from working.

I'm using ruby 2.3.

FCM (Not released on rubygems yet)

FCM has been implemented but not released with current version on Rubygems.

For those features and testing use the below steps:

Remove current version installed from rubygems and manually build:

  1. gem uninstall ruby-push-notifications
  2. git clone this_repo
  3. cd ruby-push-notifications
  4. gem build ruby-push-notifications.gemspec
  5. gem install ruby-push-notifications-x.x.x

you now have current branch version installed with the FCM implementation active.

Password for pem file

I have a password protected pem file for IOS.
How do I set the password for the pem file?
Please help.

Invalid token for APNS

I'm trying to convert from apn_on_rails to this gem and I'm not having any luck with the apn portion.

I keep getting error 8, using the same token and certificate file that I'm using with the other gem.

Is there any specific formatting that needs to be done to the token for this gem?

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.