google.appengine.api.channel.channel module
Summary
Channel API.
This module allows App Engine apps to push messages to a client.
- Functions defined in this module:
-
create_channel: Creates a channel to send messages to. send_message: Send a message to any clients listening on the given channel.
Contents
- exception google.appengine.api.channel.channel.AppIdAliasRequiredsource
-
Bases: google.appengine.api.channel.channel.Error
Error that indicates you must assign an application alias to your app.
- exception google.appengine.api.channel.channel.Errorsource
-
Bases: exceptions.Exception
Base error class for this module.
- exception google.appengine.api.channel.channel.InvalidChannelClientIdErrorsource
-
Bases: google.appengine.api.channel.channel.Error
Error that indicates a bad client id.
- exception google.appengine.api.channel.channel.InvalidChannelTokenDurationErrorsource
-
Bases: google.appengine.api.channel.channel.Error
Error that indicates the requested duration is invalid.
- exception google.appengine.api.channel.channel.InvalidMessageErrorsource
-
Bases: google.appengine.api.channel.channel.Error
Error that indicates a message is malformed.
- google.appengine.api.channel.channel.create_channel(client_id, duration_minutes=None)source
Create a channel.
Parameters-
client_id -- A string to identify this channel on the server side.
-
duration_minutes -- An int specifying the number of minutes for which the returned token should be valid.
A token that the client can use to connect to the channel.
Raises-
InvalidChannelClientIdError -- if clientid is not an instance of str or unicode, or if the (utf-8 encoded) string is longer than 64 characters.
-
InvalidChannelTokenDurationError -- if duration_minutes is not a number, less than 1, or greater than 1440 (the number of minutes in a day).
-
Other errors returned by _ToChannelError
-
- google.appengine.api.channel.channel.send_message(client_id, message)source
Send a message to a channel.
Parameters-
client_id -- The client id passed to create_channel.
-
message -- A string representing the message to send.
-
InvalidChannelClientIdError -- if client_id is not an instance of str or unicode, or if the (utf-8 encoded) string is longer than 64 characters.
-
InvalidMessageError -- if the message isn't a string or is too long.
-
Errors returned by _ToChannelError
-