GWT アプリ ( GWT-GAE-Channelを使用) で GAE Channel API (Python 2.7) を使用したいのですが、サーバー側の Python で作成されたトークンを GWT アプリに取得する方法がわかりません ("この例では index.html") を作成して、クライアント側の GWT がチャネルを開くことができるようにします。サーバー側のコードは現在次のようになっています。
import webapp2
import jinja2
import os
import uuid
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.api import channel
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
class MainPage(webapp2.RequestHandler):
#The main page returns the GWT application
def get(self):
#Create a token when the GWT app is loaded to create a channel to return data
client_id = uuid.uuid4().hex
token = channel.create_channel(client_id, duration_minutes=None)
context = {} #There are currently no template variables in the GWT app
template = jinja_environment.get_template('index.html')
self.response.out.write(template.render(**context))
class A_handler(webapp2.RequestHandler):
def post(self):
client_id = self.request.get('id')
channel.send_message(client_id, message)
app = webapp2.WSGIApplication([('/', MainPage),
('/A', A_handler)],
debug=True)
この質問と同じ GWT-GAE-Channel クライアント コードの例があります。ただし、GWT ChannelFactory.createChannel 関数のサーバーから「トークン」を受け取る GWT コードは何ですか? Python サーバーは、このトークンを GET 要求でテンプレート変数として GWT html に送信できますか、それとも RPC または他の方法で送信する必要がありますか?