The Channel API provides the following functions in the module
google.appengine.api.channel
:
- create_channel ( client_id , duration_minutes = None )
-
Creates a channel. Returns a token for use by the JavaScript client listening on the channel.
Arguments
- client_id
- An application-created string the server uses to identify individual JavaScript clients.
- duration_minutes
-
The number of minutes for which the returned token will be valid.
If
None
, use default (120 minutes). If specified, the value must be greater than zero and less than 24 * 60.
- send_message ( client_id , message )
-
Asynchronously sends a message to a channel. No error is returned if the message cannot be delivered. If the
client_id
parameter is actually a token returned by acreate_channel
call thensend_message
can be used for different versions of the app. For instance you could create the channel on the front end and then send messages from a backend of the app.Arguments
- client_id
-
The key identifying a JavaScript client. This can be the
client_id
used in acreate_channel
call or the token returned by such a call. The advantage of using the token is thatsend_message
will work from a different version of the application than the one that created the channel. - message
- The message passed to the client.