如何从Android发送XMPP消息使用到GAE上的Smack [英] How to send a XMPP message from Android to GAE using Smack

查看:223
本文介绍了如何从Android发送XMPP消息使用到GAE上的Smack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用拍击从我的Andr​​oid客户端发送XMPP消息到GAE服务器。
我读这个帖子与Gmail的设置,得到的应该是如何做的想法。但我不如何设置主机服务名我的谷歌应用程序引擎帐户。

 字符串主机=talk.google.com;
INT端口= 5222;
字符串服务名gmail.com;ConnectionConfiguration connConfig =新ConnectionConfiguration(主机,端口,服务名);XMPPConnection连接=新XMPPConnection(connConfig);
connection.connect();消息味精=新消息(于Message.Type.chat);
msg.setBody(文本);
connection.sendPacket(MSG);


解决方案

XMPP可以工作在几个不同的传输机制。

GAE适用于HTTP,因此您的XMPP客户端将可能有(通过HTTP XMPP)支持BOSH
这里的规范: http://xmpp.org/extensions/xep-0124.html

您会再使用在GAE XMPP文档中描述的URL和XMPP地址:
https://developers.google.com/appengine/docs/java/xmpp/overview

我还没有看到任何文件指定一个端口号为GAE XMPP,我怀疑这是不支持的,所以你不能够插座进行连接。

I want to send XMPP message from my android client to GAE Server using Smack. I read this post with gmail settings and got the idea of how it should be done. But I don't how to setup the host and serviceName for my google app engine account.

String host = "talk.google.com";
int port = 5222;
String serviceName gmail.com;

ConnectionConfiguration connConfig = new ConnectionConfiguration(host ,port , serviceName);

XMPPConnection connection = new XMPPConnection(connConfig);
connection.connect();

Message msg = new Message(to, Message.Type.chat);
msg.setBody(text);
connection.sendPacket(msg);

解决方案

XMPP can work over a few different transport mechanisms.

GAE works on HTTP, so your XMPP client will probably have to support BOSH (XMPP over HTTP) Here's the spec: http://xmpp.org/extensions/xep-0124.html

You would then use the URLs and XMPP addresses described in the GAE XMPP docs: https://developers.google.com/appengine/docs/java/xmpp/overview

I haven't seen any documentation specifying a port # for GAE XMPP, I suspect it's not supported, so you won't be able to connect over sockets.

这篇关于如何从Android发送XMPP消息使用到GAE上的Smack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆