views:

474

answers:

2

may i know what integration technique that you folks use to implement external component to an existing XMPP server (e.g. ejabberd or OpenFire) . Is it through sending xmpp message to another user@externaldomain directly or using mechanism like urlfetch?

+1  A: 

App Engine supports a very limited subset of XMPP. Basically, you can send messages (through the API), and you can receive messages (they come in as HTTP requests).

Java API
Python API

You could rig up an external component on your existing XMPP server, to send and receive messages with your app engine code. That component would have to keep track of whatever it is you want to send and receive from your app.

Adam Goode
any articles/references on how to use external xmpp with gae?
cometta
You don't do anything special to talk to a component from XMPP. You just send/receive messages using a jid, as before. Note that is about all that GAE XMPP can do. Your fancy component must be on another server that you run.
Adam Goode
+2  A: 

Google app engine (Gae) does support XMPP just as CLIENT.

With XMPP Gae JAVA client feature you can:

SEND MESSAGE

JID jid = new JID("[email protected]");
Message msg = new MessageBuilder()
    .withRecipientJids(jid)
    .withBody("Hello i'm a fancy GAE app, how are you?")
    .build();                    
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
if (xmpp.getPresence(jid).isAvailable()) {
   SendResponse status = xmpp.sendMessage(msg);               
}

RECEIVE MESSAGE

public class XMPPReceiverServlet extends HttpServlet {
  public void doPost(HttpServletRequest req, HttpServletResponse res)
          throws IOException {
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    Message message = xmpp.parseMessage(req);    
    JID fromJid = message.getFromJid();
    String body = message.getBody();
    //Save to Big Table
  }
}

Remember that JIDs can just be [email protected] OR [email protected] because Google domains are not supported yet.

For example, you could craft a toy Gae application with a simple page with:

  1. An html form to send text
  2. An html table that display the list of messages received and stored to big table.

To test your application:

  1. Create an account on jabber.org
  2. Download Smack
  3. Try to send a message from Smack to [email protected]
  4. Try to send a message from Gae App to [email protected]

In case you have your personal XMPP server (openfire) up and running, simply skip step 1 and use your domain account to receive message from your fancy Gae App.

Have a look to XMPP message delivery to understand how this works.

systempuntoout
@systempuntoout, can you comment on this post http://stackoverflow.com/questions/2570800/appspot-xmpp-talk-with-jabber-org
cometta