Deploying the GAE XMPP service as an external component to an existing XMPP server (for example, ejabberd or OpenFire)

Can I find out what integration technique you use to implement an external component on an existing XMPP server (for example, ejabberd or OpenFire). Is this sending an xmpp message to another @externaldomain user directly or using a mechanism like urlfetch?

+3
source share
2 answers

The Google app engine (Gae) supports XMPP in the same way as CLIENT .

Using the XMPP Gae JAVA function, you can:

SEND A MESSAGE

JID jid = new JID("youraccount@jabber.org");
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);               
}

GET 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
  }
}

, JID yourappid@appspot.com foo@yourappid.appspotchat.com Google .

, Gae

  • html
  • html, .

:

  • jabber.org
  • Smack
  • Smack yourappid@appspot.com
  • Gae youraccount@jabber.org.

XMPP (openfire), 1 , Gae.

XMPP , , .

+6

App Engine XMPP. , ( API), ( HTTP-).

Java API
Python API

XMPP, . , .

+1

Source: https://habr.com/ru/post/1721367/


All Articles