Google App Engine allows developers to build and host web applications on Google's infrastructure without having to maintain servers. The Channel API enables real-time communication between a client-side JavaScript application and an App Engine application by creating a persistent connection. It uses tokens to allow clients to connect to channels, through which the App Engine application can push messages to clients without polling. Clients connect to their channel, listen for messages, and can send messages back via HTTP requests.
2. What Is Google App Engine(GAE)?
• Google App Engine lets you run web applications on
Google's infrastructure.
• With App Engine, there are no servers to maintain: you
just upload your application, and it's ready to serve your
users.
• Google App Engine applications can currently be written
in Java, Python, or Go.
4. Channel API(Push)
• Creates a persistent connection between your
application and Google servers
• Allows your application to send messages to JavaScript
clients in real time without the use of polling.
5. Channel API(Push)
Javascript Client:
– Connecting to the channel once it receives the channel’s unique
token from the server
– Listening on the channel for updates
– Sending update messages to the server
The Server:
– Creating a unique channel for individual JavaScript clients
– Creating and sending a unique token to each JavaScript client
so they may connect and listen to their channel
– Receiving update messages from clients via HTTP requests
– Sending update messages to clients via their channels
– Optionally, managing client connection state.
6. Channel API(Push)
The Client ID:
– The Client ID is responsible for identifying individual JavaScript
clients on the server.
– A Client ID can be anything that makes sense in the design of
your application.
Tokens:
– Tokens are responsible for allowing the JavaScript Client to
connect and listen to the channel created for it.
– The server creates one token for each client using information
such as the client’s Client ID and expiration time.
– Tokens expire after two hours and should also be treated as
secret.
7. Channel API(Push)
The Channel
– A channel is a one-way communication path through which the
server sends updates to a specific JavaScript client identified by
its Client ID.
– The server receives updates from clients via HTTP requests,
then sends the messages to relevant clients via their channels.
The Message
– Messages are sent via HTTP requests from one client to the
server.
– Once received, the server passes the message to the
designated client via the correct channel identified by the Client
ID.
– Messages are limited to 32K.