bpstudy #40 - google appengine 1.4.0
TRANSCRIPT
Google Appengine 1.4.0
Channel API, Warmup Requests, Metadata Queries
http://s.beproud.jp/channel-api
: Ian Lewis
: BeProud
: #beproud #redbull #python #django #appengine #kayja #kay_fw
Appengine API Expert
http://www.ianlewis.org/
http://twitter.com/IanMLewis
http://bitbucket.org/IanLewis
google.appengine.api.labs.taskqueue deprecated google.appengine.api.taskqueue
Cron 10
DataStore
NamespaceEntityProperty
for namespace in Namespace.all(): print namespace.namespace_name
for kind in Kind.all(): print kind.kind_name for property in Property.all().ancestor(kind): print " %s" % property.property_name
Always On
3
spin up
Warmup Request
Warmup Request
warmup
inbound_services:- warmup
- url: /_ah/warmup.* script: warmup.py
import mybigmoduleimport myothermodule
def main(): print "Content-type: text/plain" print "OK"
Channel API
push
Channel API
Channel API
ID
Channel API
from google.appengine.ext import webappfrom google.appengine.api import channelfrom django.template.loader import render_to_string
class MyHandler(BaseHandler): def get(self): user = users.get_current_user() # # create_channel id = channel.create_channel(user) return self.response.out.write(render_to_string("index.html", {"channel_id": id}))
Channel API
from google.appengine.api import channelfrom google.appengine.api import usersclass AjaxHandler(BaseHandler): def get(self): user = users.get_current_user() # # # # JSON channel.send_message(user, "Hello World!!")
Channel API
var channel = new goog.appengine.Channel("{{ channel_id }}");var socket = channel.open();socket.onopen = function() { window.setTimeout(function() {alert('Connected!')}, 100);}// socket.onmessage = function(evt) { // JSON // var o = JSON.parse(evt.data); alert(evt.data); // do something}
Channel Socket
http://s.beproud.jp/bpstudy40demo
http://s.beproud.jp/bpstudy40map
[email protected]@IanMLewis