Code Monkey home page Code Monkey logo

apns's People

Contributors

jpoz avatar michaelbaker avatar mvanholstyn avatar samchandra avatar shuhei avatar toto 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apns's Issues

Sending umlauts as push messages (from rails view)

I have a view, which should send push messages. As soon as I enter umlauts in my text, it is not submitted. This can be reproduced like this:

device_token = '123abc456def'
APNS.send_notification(device_token, :alert => 'Hellö iPhöné', :badge => 1, :sound => 'default')

I am using ruby 1.9 and Rails 3.0.x. Thanks for your help. For plain ASCII messages though your gem rocks!

APNS.send_notifications doesn't handle bad device token well

I'm observing an issue with the batch notifications method send_notifications

If one of the device token in the request is incorrect due to any reason, the batch notification would stop at the bad token without any error response. An example as the following:

  • T: device token, M: message
  • Send batch notifications for 3 messages T1-M1, T2-M2, T3-M3
  • If T2 is problematic, only T1-M1 would succeed. T3-M3 would fail. The request wouldn't have any error messages indicating that the request have failed

Is it possible to fix this issue?

Feedback Service Returning Weird Response?

Hi,

I have a fairly large iOS user base, feedback service returns plenty of stuff all the time.

This script, though:

#!/usr/bin/env ruby

require 'rubygems'
require 'apns'
require 'socket'
require 'openssl'
require 'base64'

APNS.pem = 'production.pem'
APNS.host = 'gateway.push.apple.com'

APNS.feedback.each {|e| puts e}

Returns results like this:

feedback.push.apple.com
1982-03-27 11:27:14 +0100
9f389bede247500458c16d80de8af8ef8d05af28c313889b13eaecd77305fc8ad8d76c672df29a6a1ed0be63a89947895c6bce462d803999214e8739c31537e5cf322586136b

I've got all sort of crazy dates, including:

1982-03-27 11:27:13 +0100
2049-10-21 12:29:29 +0200
2009-04-13 11:04:07 +0200
2037-07-24 23:24:17 +0200

And the token never matches any of the tokens I have in my database. Notice that I can use the configuration above to send push notifications via APNS without any problem.

Am I doing something wrong here or there is a problem?

APNS class file

Hello,

I've it all installed but I haven't seem any APNS class file to setup host, pem and port. No configurations file at all were created when I installed the gem.

What am I missing?

Thanks!

Silent Push Notification

Hi jpoz,

I'm trying to use silent push notification, and it seen need to provide the key "content-available" with a value of 1, so that I can use it. But, when I write:

APNS.send_notification(device_token, :content-available => 1}

It'll send a syntax error message. How can I solve it?

Duplicated pushes

Hello, I'm using your gem for one of my project.
The project allows the user to send a push notification of an event, a user can have multiple events.
When I use this code to send the push:

push_notification.devices.each do |d|
         APNS.send_notification(d.token, :alert => push_notification.event.title, :badge => 0, :sound => 'default', :other => {:event_id => push_notification.event.id})  
      end

everything works fine.

if insteas I use this code

 pushes = [] 
      push_notification.devices.each do |d|
         pushes << APNS::Notification.new(d.token, :alert => push_notification.event.title, :badge => 0, :sound => 'default', :other => {:event_id => push_notification.event.id})  
      end
       APNS.send_notifications(pushes)

I receive, on the phone side, pushes for events I pushed even yesterday (actually for all the events that have been pushed).
I'm not saying this is a bug of your gem, maybe it's about the way the apple manages the push requests, just to let you know.

gemspec missing dependency on json

$ cat Gemfile
source :rubygems
gem 'apns'

irb(main):002:0> require 'bundler/setup'
=> true
irb(main):004:0> require 'apns'
LoadError: no such file to load -- json
        from /usr/local/lib/ruby/gems/1.8/gems/apns-0.9.0/lib/apns/core.rb:4:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/apns-0.9.0/lib/apns/core.rb:4
        from /usr/local/lib/ruby/gems/1.8/gems/apns-0.9.0/lib/apns.rb:1:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/apns-0.9.0/lib/apns.rb:1
        from (irb):4:in `require'
        from (irb):4

As json is used the gemspec should declare a dependency on it.

Add support for persistent connections

APNS appears to close the connection after each message (or group of messages). From the APNS documentation:

Keep your connections with APNs open across multiple notifications; don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack. You should leave a connection open unless you know it will be idle for an extended period of time—for example, if you only send notifications to your users once a day it is ok to use a new connection each day.

In the worst case scenario, I could see Apple revoking your push certificate should your volume increase to the point they consider it a DDOS attack.

256 bytes limitation

Hi all,
I spent hours of debugging to find out that the notification didn't work because of the 256 bytes limitation.
It would be nice to raise an error when the payload exceeds 256 bytes.

Would a raise "Error" if message.to_json.size > 256 work in Notification.initialize(device_token, message) ?

feedback method

Hello!

I wanted to ask if the feedback method works. If it does could this be released as a gem?

Thanks :)

send_notification returning nil with no status of notification

I'm using following for sending the notification.

APNS.host = 'gateway.push.apple.com'
APNS.pem = "#{Rails.root}/doc/pushcert.pem"
APNS.port = 2195
APNS.send_notification(token, message)

but all it is returning is nil and notifications are not being sent and all the associated article call APNs a black box with not round about for this.
Is there any way to figure out the errors and reasons for notifications not being delivered ?

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can image, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Emoji in alert are not working

I am using apns on a legacy app with following specs. We can't upgrade it rails latest version, so we are looking for solution like upgrading apns only or some monkey patch if possible.

Rails 3.2
Ruby 1.9.3
APNS 1.0.0
mysql 0.3.18

I am not able to send emoji to iOS application in alert dictionary. Emojis are saved in a field along text data in table.

APNS.send_notification(device_token, alert: { title: "New Room!", body: "We can talk about anything here \\ud83c\\udfc0\\ud83c\\udfe0\\ud83d\\udcb4" }, badge: 0, sound: "default", other:
       { info: { type: 'new_room', bug_id: 1, bug_name: "We can talk about anything here \\ud83c\\udfc0\\ud83c\\udfe0\\ud83d\\udcb4", :bug_creator_id => 5, bug_creator_name: 'Zeeshan'}} )
       ```

APN over https

I'm having trouble with explicitly tell APNs to send out notifications of https. Is there a way to accomplish this?

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.