Tracking connections and disconnections
An App Engine application is responsible for the creation of channels and the transmission of the token, but it doesn't know whether the JavaScript client is connected or not. For example, our Notes application sends a message upon the creation of a new note through the inbound e-mail service, but on the other side, the JavaScript client might or might not receive it. In some contexts, this is not an issue, but there are several use cases where an App Engine application needs to know when a client connects or disconnects from a channel.
To enable channel notifications, we first need to enable inbound Channel presence service. To do this, we have to change our app.yaml
configuration file by adding the following code:
inbound_services: - mail - channel_presence
Now that the presence
service is enabled, our Notes application will receive HTTP POST
requests to the following URLs:
- The
/_ah/channel/connected/
URL: When a JavaScript client has connected...