Java 如何使用Smack从Android向GAE发送XMPP消息
我想使用Smack从android客户端向GAE服务器发送XMPP消息。 我阅读了gmail设置,了解了应该如何做。但我不知道如何为我的谷歌应用程序引擎帐户设置Java 如何使用Smack从Android向GAE发送XMPP消息,java,android,google-app-engine,xmpp,smack,Java,Android,Google App Engine,Xmpp,Smack,我想使用Smack从android客户端向GAE服务器发送XMPP消息。 我阅读了gmail设置,了解了应该如何做。但我不知道如何为我的谷歌应用程序引擎帐户设置主机和serviceName String host = "talk.google.com"; int port = 5222; String serviceName gmail.com; ConnectionConfiguration connConfig = new ConnectionConfiguration(host ,por
主机
和serviceName
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可以使用几种不同的传输机制 GAE在HTTP上工作,因此您的XMPP客户端可能必须支持BOSH(XMPP over HTTP) 以下是规格: 然后,您将使用GAE XMPP文档中描述的URL和XMPP地址:
我还没有看到任何为GAE XMPP指定端口的文档,我怀疑它不受支持,因此您将无法通过套接字进行连接。谢谢,我现在更清楚了一点。我在链接中没有看到任何java代码。也许你知道java教程?也许你可以使用谷歌搜索“xmpp bosh java客户端”。嗨@dragonx。我一直在尝试创建XMPPConnection,但连接失败。但XMPPServer启动正常。你能看看我的问题,看看你能不能帮我?先谢谢你。