使用XMPP在Android用户推送通知 - 任何方式针对这些这样他们就不会去谷歌通话等

使用XMPP在Android用户推送通知 - 任何方式针对这些这样他们就不会去谷歌通话等

问题描述:

我要使用XMPP,推动使用他们的谷歌-ID进行登录,以我的申请资料到我的客户端,将转化为一个通知用户,并计划。我明白XMPP的方式是,它的一个简单的消息,直接转到联系地址,但我想在客户端得到它为指导,把它变成游戏状态信息。

I want to use XMPP to push data to my client which would translate to a notification for the user, and plan on using their google-id for login to my application. The way I understand XMPP is that its a simple message that goes directly to the adress, but I want the client to get it as instructions and turn it into gamestate information.

这将是非常令人沮丧的用户得到了一堆命令的元组或十六进制的垃圾在他们的谷歌聊天!我误解的方式这一切工作?

It would be very frustrating for a user to get a bunch of command tuples or hex garbage in their google chat! Am I misunderstanding the way this all works?

的JID(Jabber的/ XMPP的ID,因此谷歌通话的ID)有几种形式。

JIDs (Jabber/XMPP IDs and therefore Google Talk IDs) have several forms.

首先是一个裸JID,如: user@example.com
其次是全JID,如: user@example.com/xyz123 ,其中 XYZ123 叫资源

First is a "bare JID", e.g.: user@example.com
Secondly is a "full JID", e.g.: user@example.com/xyz123, where xyz123 is called the resource.

一个用户可以使用,只要每个客户端采用了独特的资源登录到多个客户端同时他们的XMPP账户。随着谷歌对话,通常是服务器分配的资源。

One user can be logged into their XMPP account from multiple clients simultaneously, so long as each client uses a unique resource. With Google Talk, usually the server allocates the resource.

当你跟某人XMPP通常你解决使用其裸JID&mdash消息;你不关心它的客户端的消息被传递到;该人的服务器指示它基于其可用性等适当的客户端(多个)。

When you talk to someone on XMPP normally you address messages using their bare JID — you don't care about which client the message gets delivered to; that person's server directs it to the appropriate client(s) based on their availability etc.

但是,你也可以直接邮件发送到一个完整的JID。这是你想要做什么,这样只有 user@example.com/my-game-some-unique-ID 收到您的游戏特定的消息。

But you can also address a message directly to a full JID. This is what you want to do, so that only user@example.com/my-game-some-unique-ID receives your game-specific messages.

无论是谷歌App Engine的API为您提供了这样的灵活性,我不知道:)

Whether the Google App Engine API gives you this flexibility, I have no idea :)

这是另一种—再次,如果GAE允许这种—是发送一个不同的消息类型。
X MPP为e的 X tensible,这意味着你不必送一个普通的老<消息/> 节给最终用户;你可以坚持一个专门的有效载荷里面有像<游戏/> 子节,而且因为经常IM客户端不知道如何分析你的<游戏/> 节,他们什么都不显示给用户。只有你的游戏客户端将解析和理解这些信息。

An alternative — again, if GAE allows this — is to send a different message type.
XMPP is eXtensible, meaning that you don't have to send a plain old <message/> stanza to the end user; you can stick a specialised payload inside there like a <game/> child stanza and, because regular IM clients don't know how to parse your <game/> stanzas, they show nothing to the user. Only your game client will parse and understand this info.