Push guestbook #97

Closed
wants to merge 12 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

petewil-G commented May 3, 2013

Justin - please check out these changes

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/guestbook-srv/guestbook.py
+ http://localhost:8080/startpush
+ Sign guestbook, and any guestbook-app clients should get the most recent
+ message.
+"""
+
+import logging
+import os
+import random
+import sys
+sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
+import httplib2
+from oauth2client.appengine import CredentialsModel
+from oauth2client.appengine import StorageByKeyName
+from oauth2client.client import AccessTokenRefreshError
+from oauth2client.client import flow_from_clientsecrets
+import json as simplejson
@mrdewitt

mrdewitt May 6, 2013

I think this should be rewritten to just "import json". Then find all the instances of the word "simplejson" below and replace with just json. It will be clearer. Also, a liner note saying to use python2.7 with this example would be helpful.

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+* Add <code>http://localhost:8080/oauth2callback</code> to the list of Redirect
+ URIs for your Client ID (yes, http, not https for the sample.)
+* Download JSON for your client ID, and save it in the path
+ <code>$PROJECT\_ROOT/guestbook-srv/client\_secrets.json</code>.
+* Click on the "Services" item on the left nav bar.
+* Scroll down to "Google Cloud Messaging for Chrome", and turn it on.
+
+## How to serve from your local machine: ##
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
@mrdewitt

mrdewitt May 6, 2013

The new instructions here don't make sense. Is this in the right place? If it is an instruction for uploading to the Chrome Web Store, make it a sub-item by using two *s.

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
@@ -0,0 +1,46 @@
+# Push Messaging Guestbook
+
+Sample that shows how to use the [Push Messaging
+API](http://developer.chrome.com/trunk/apps/pushMessaging.html) in an app.
+
+How to install on your local machine:
+
+* Download the [Google App Engine SDK for
+ Python](https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python).
+* Ensure that <code>dev\_appserver.py</code> is in your PATH
+* Go to the [Developer Console](https://code.google.com/apis/console/), and request a "Client ID for Web Applications"
+ using the " API Access" nav bar item, click on "Create an OAuth2 client ID".
@mrdewitt

mrdewitt May 6, 2013

nit: remove space before API.

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+* Click on the "Services" item on the left nav bar.
+* Scroll down to "Google Cloud Messaging for Chrome", and turn it on.
+
+## How to serve from your local machine: ##
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
+* click "Add new item"
+* Download it back to your browser, and click the icon to open the main window.
+ it should have a message like "The last Guestbook message was".
+* Don't launch the client app until the server is running, and you have done the startpush command in the browser. It registers with the server. If you do end up starting the client app too early, you can try first killling it from the chrome://extensions page, and if that doesn't work, you can restart the dev_appserver with the --clear_datastore argument.
@mrdewitt

mrdewitt May 6, 2013

"Done the startpush command" is unclear. Replace with "navigated to localhost.../startpush [put the true URL in] and authorized your appserver to send messages."

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+
+## How to serve from your local machine: ##
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
+* click "Add new item"
+* Download it back to your browser, and click the icon to open the main window.
+ it should have a message like "The last Guestbook message was".
+* Don't launch the client app until the server is running, and you have done the startpush command in the browser. It registers with the server. If you do end up starting the client app too early, you can try first killling it from the chrome://extensions page, and if that doesn't work, you can restart the dev_appserver with the --clear_datastore argument.
+* Navigate to <code>http://localhost:8080/startpush</code> and login with the account with push. You should only have to do this once, not every time.
+ message permission
@mrdewitt

mrdewitt May 6, 2013

nit: incomplete sentence.

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+ URIs for your Client ID (yes, http, not https for the sample.)
+* Download JSON for your client ID, and save it in the path
+ <code>$PROJECT\_ROOT/guestbook-srv/client\_secrets.json</code>.
+* Click on the "Services" item on the left nav bar.
+* Scroll down to "Google Cloud Messaging for Chrome", and turn it on.
+
+## How to serve from your local machine: ##
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
+* click "Add new item"
@mrdewitt

mrdewitt May 6, 2013

nit: capitalize Click

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+## How to serve from your local machine: ##
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
+* click "Add new item"
+* Download it back to your browser, and click the icon to open the main window.
+ it should have a message like "The last Guestbook message was".
+* Don't launch the client app until the server is running, and you have done the startpush command in the browser. It registers with the server. If you do end up starting the client app too early, you can try first killling it from the chrome://extensions page, and if that doesn't work, you can restart the dev_appserver with the --clear_datastore argument.
+* Navigate to <code>http://localhost:8080/startpush</code> and login with the account with push. You should only have to do this once, not every time.
+ message permission
+* Now launch the push messaging sample app
@mrdewitt

mrdewitt May 6, 2013

nit: remove Now, capitalize launch and add period.

@mrdewitt mrdewitt commented on the diff May 6, 2013

push-guestbook/README.md
+
+ ~ cd $PROJECT_ROOT/guestbook-srv
+ ~ dev_appserver.py .
+
+## How to enable push messaging:
+
+* Upload the app in <code>$PROJECT\_ROOT/guestbook-app</code> to the Chrome Web Store.
+* Go to the Chrome Web Store, click the "gear" icon, and choose "Developer Dashboard".
+* click "Add new item"
+* Download it back to your browser, and click the icon to open the main window.
+ it should have a message like "The last Guestbook message was".
+* Don't launch the client app until the server is running, and you have done the startpush command in the browser. It registers with the server. If you do end up starting the client app too early, you can try first killling it from the chrome://extensions page, and if that doesn't work, you can restart the dev_appserver with the --clear_datastore argument.
+* Navigate to <code>http://localhost:8080/startpush</code> and login with the account with push. You should only have to do this once, not every time.
+ message permission
+* Now launch the push messaging sample app
+* Send push messages <code>http://localhost:8080</code>
@mrdewitt

mrdewitt May 6, 2013

nit: explain how to send push messages. I.e. sign the guestbook. This will cause your server to send push messages to the clients.... etc.

Member

scheib commented May 28, 2014

This is an old patch, please reopen and merge if there are relevant changes still.

scheib closed this May 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment