O'Reilly logo

Programming Google App Engine by Dan Sanderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Receiving XMPP Messages

With the xmpp_message inbound service enabled, an app can receive XMPP messages sent by users and clients of XMPP chat services, such as Google Talk. Incoming messages are routed to the application in the form of HTTP requests to a specified URL. This is similar to how an app can receive email.

An app can receive two kinds of XMPP messages: “chat” and “normal.” Chat messages are sent by user-operated instant messaging clients, and usually represent a conversation. Normal messages are general purpose messages, which you might use for custom clients. Notice that this means an app cannot be a participant in a group chat.

An app receives XMPP messages at several addresses. Messages sent to addresses of these forms are routed to the default version of the app:

    app-id@appspot.com

    anything@app-id.appspotchat.com

Messages sent to addresses of this form are routed to the specified version of the app, useful for testing:

    anything@version.latest.app-id.appspotmail.com

Each message is delivered to the app as an HTTP POST request to the following URL path:

    /_ah/xmpp/message/chat/

(Unlike incoming email, the sender JID is not included in the URL path.)

The body content of the HTTP POST request is a MIME multipart message, with a part for each field of the message:

from

The sender’s JID.

to

The app JID to which this message was sent.

body

The message body content (with characters as they were originally typed).

stanza

The full XML stanza of the message, including the previous fields ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required