-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rest service, disconnect log and enhanced notifications #40
base: master
Are you sure you want to change the base?
Conversation
this implements a new rest service to eventually replace the xmlrpc service. the xmlrpc service should continue working normally for now. the rest service uses the new enhanced notifications format and therefore can offer a disconnection log of recent disconnections and their reasons docs and client implementation forthcoming
has no configuration built in by default
* updated conf * updated pyapns.tac
All I need to do now is finish up the docs and I feel comfortable releasing this. We are using this branch in production @ Lightt. |
I've used this a bit for testing on a local machine and so far it has worked well. If anyone has any tips on deployment up on AWS I'd love to hear what environment is working for you and what your config files look like. On Jan 30, 2013, at 12:09 PM, Samuel Sutch wrote:
|
@trippoli what is your target environment? At lightt we just have our machines point directly at the twisted process. In larger installations they distribute 4 twisted processes behind nginx or haproxy. |
Our backend runs on Google App Engine… My current dev environment is running pyapns and app engine locally. Things are working well. So I'm looking to spin up a single APNS server up on AWS and point our production AppEngine push queue at it. I'm just inexperienced with AWS configuration. It seems like firing up a single APNS server on one of their python beanstalks would be pretty straightforward for someone familiar with the AWS stack. From my reading it would seem that it should be entirely possible to get things setup to pull a git repo and fire it up if the proper configs were in place. I was just suspecting that someone who is already using pyapns has a working example of a config I could start from. -s On Jan 31, 2013, at 6:54 PM, Samuel Sutch wrote:
|
Here's the sort of thing that would have gotten me going. It's my notes from getting our instance up: Notes for getting pyapns up on e2c This assumes you have:
In the ubuntu shell: sudo apt-get install git
config_file = '/home/ubuntu/pyapns/application_config.json' Next edit the application_config.json with your info and make paths like the config file path. zip the items into a file called 'config.zip'
from a local shell:
Correct any trouble with paths, if you see errors like: ..then you have path problems. Fire it up in the debugger if needed and poke around: (Pdb) import pyapns
-- this creates the pid file you can view via kill -s sigint to shut it down
On Jan 31, 2013, at 7:14 PM, Steven Troppoli wrote:
|
Good point, if it doesn't already do this a pull request would be much appreciated! |
Clear disconnection events after getting them
Fix a bug: ClientError __init__() needs 3 arguments
Add an option: bind pyapns to a specified IP address
Add options to config log file
The `ensure_ascii` kwarg in `json.dumps()` must be `True` (the default) so that the subsequent UTF-8 encoding works correctly.
Add requests to setup.py, fix UTF-8 crash.
Running this branch in development and encountered the following
How should the client code handle this case? log information: 2013-10-03 16:24:54-0400 [HTTPChannel,612,10.1.1.242] 10.1.1.242 - - [03/Oct/2013:20:24:54 +0000] "POST /apps//sandbox/notifications HTTP/1.1" 201 26 "-" "" After reviewing the closed issues, I think the above use case is similar to |
…ablished for over an hour without any activity. Reconnect to APNS if the connection has been established for an hour prior to writing.
Apple timed disconnect
Add call to stopTrying on the APNSClientFactory (ReconnectingClientFactory) in the timed disconnect portion of the code. If this call is not made, the reconnecting code will reconnect to Apple and the connection is left unreferenced. This can cause an issue with 'Too many open files'.
Fix for leaking file descriptor issue
Its unclear to me at this moment what the outstanding issues are in getting this branch merged back into master. Can anyone who's more familiar give an update? |
Primarily documentation |
You need help with something? I would be more than happy to help documenting stuff :) |
Yeah! I wish I had time to do this stuff: If you look at the README in this branch vs master you can sort of tell where it's lacking. Specifically we need docs for all of the REST endpoints, how this version differs from master, and how to upgrade from this version to the last. |
Hi... This stuff is really nice, do you know approximately how long a release would take? |
If I had the time (or my time could be bought) it would take me no more than a day. |
Use TLSv1 instead of SSLv3
Version .50 includes:
requests
libraryFixes: #31 #26 #14
Todo:
python client implementation using kennethreitz/requestsI also pep8-ified (much as possible) the old XML-RPC server and APN protocol code.
Rest Interface:
GET /apps
Returns a list of available apps
POST /apps/:app id/:environment
{"cert": "/path/to/cert or cert file itself","timeout":15}
Provisions an app. You send it a dictionary with keys for
cert
andtimeout
POST /apps/:app id/:environment
[{"payload":{"alert":"abc"},"token":"tok","identifier":"ident","expiry":1234}]
Sends a notification. You send it a list of dictionaries each with
payload
,token
,identifier
, andexpiry
keysGET /apps/:app id/:environment/feedback
Returns feedback directly from APN
GET /apps/:app id/:environment/disconnections
Returns a list of the most recent 5000 disconnections paired with the reason and notification that caused the disconnection