groupme / em-apn Goto Github PK
View Code? Open in Web Editor NEWEventMachine'd Apple Push Notifications
License: MIT License
EventMachine'd Apple Push Notifications
License: MIT License
Hey i like the looks of this. Any chance we'll see it on Rubygems.org soon?
When I send an invalid token i get:
I, [2011-11-11T11:56:32.038103 #41783] INFO -- : TOKEN=df6f35d25288c0be4ed6e91cc404439c1b79b02999d662c7d65b139289bcbdc0
I, [2011-11-11T11:56:32.173585 #41783] INFO -- : CODE=8 ID=256 DESC=Invalid token
Got data: [8, 8, 256]
The last line is my on_receipt output.
If i then send a valid token i see
I, [2011-11-11T11:56:54.579125 #41783] INFO -- : TOKEN=520b12a526c0788425e5c9f6a7fd069eaf99d5ddda296fad2317b0e2dc9e44aa
and nothing further.
If i then send a broken token again, i do not get a reciept.
This makes me think that em-apn is not reestablishing the connection, and not letting us know it's down.
Since iOS 8 was released, Apple now allow payloads up to 2048 Bytes.
Currently there is no payload trimming in Notification
class.
As documentation states: "The payload must not exceed 256 bytes and must not be null-terminated.". From my experience problems will start appearing on production gateway.
I come from apn-sender. Apn-sender is not support apn so I want give a try on em-apn
When I walk through em-apn code , find I can use ./script/pusher , to send notifications to apple.
Apn-sender have a worker for resque-jobs. Does em-apn have plan on this kind of feature?
When I run on Unicorn server, I got this:
RuntimeError (eventmachine not initialized: evma_connect_to_server):
app/models/message_service.rb:4:in `deliver'
And It works well on Thin.
Here's my code
class MessageService
def self.deliver(message)
client = EM::APN::Client.connect(
:key => message.project_apn_key.current_path,
:cert => message.project_apn_cert.current_path
)
client.on_error do |response|
# See EM::APN::ErrorResponse
ap response
end
client.on_close do
# Do something.
end
message.groups.each do |group|
group.devices.each do |device|
notification = EM::APN::Notification.new(
device.token,
:alert => message.alert,
:badge => message.badge,
:sound => message.sound
)
client.deliver(notification)
end
end
end
end
I don't understand.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.