在Firebase Cloud Messaging上通过XMPP传递上游消息的误解 [英] Delivering upstream messages via XMPP on Firebase Cloud Messaging misconceptions

查看:174
本文介绍了在Firebase Cloud Messaging上通过XMPP传递上游消息的误解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的应用程序中设置FCM功能。目前,我想显示一个按钮,以便当用户按下按钮时,会生成一条发送给Google CCS的上游消息。我的理解是,这条上游消息将由Google CCS转变为XMPP节。然后,它会在创建上游消息时被传送到具有我设置的ID的电话。从google阅读FCM上的文档后,我发现创建上游消息非常简单:

  FirebaseMessaging fm = FirebaseMessaging .getInstance(); 
fm.send(新的RemoteMessage.Builder(SENDER_ID +@ gcm.googleapis.com)
.setMessageId(Integer.toString(msgId.incrementAndGet()))
.addData( my_message,Hello World)
.addData(my_action,SAY_HELLO)
.addData()//这里的某处必须设置手机的senderId
//我试图发送消息给
.build());

现在通过查看上面的代码,我看不出XMPP用于创建此上游消息。没有XMPP节创建。我的问题涉及这个XMPP节在哪里交付?一旦离开Goog​​le的CCS。我在扩展
FirebaseMessagingService的类上看到一个名为onMessageReceived的方法。我的理解是,在这种方法中,XMPP节将被放置。或者,它将在我打算设置哪个PacketListener的Smack库连接上传送。根据Gronkking Android的例子,谷歌的CCS XMPP节将在这里提供这个packetlistener。我打算按照这个例子来接收这些未来的节,并生成所需的ack消息。



如果任何人有任何想法或想法,听到您的意见将是非常好的



谢谢

解决方案

FCM不支持设备到设备消息传递。上行消息旨在从您的移动设备通过CCS传输到您的XMPP应用服务器。一旦您的XMPP应用服务器收到该消息,它可以决定通过CCS将下行消息发送到移动设备。 XMPP与节的通信在CCS和XMPP应用服务器之间完成。


I am trying to set up FCM functionalities into my app. At the moment, I would like to display a button such that when the user presses the button an upstream message is generated which is sent to Google's CCS. It is my understanding that this upstream message will be turned into an XMPP stanza by the Google CCS. Then, it will be delivered to the phone that has the id I set to when creating the upstream message. After reading the documentation on FCM from google, I see that it is very simple to create an upstream message:

FirebaseMessaging fm = FirebaseMessaging.getInstance();
fm.send(new RemoteMessage.Builder(SENDER_ID + "@gcm.googleapis.com")
.setMessageId(Integer.toString(msgId.incrementAndGet()))
.addData("my_message", "Hello World")
.addData("my_action","SAY_HELLO")
.addData()//somewhere in here must be a way to set the senderId of the phone
// i am trying to send the message to ??? 
.build());  

Now by looking at the code above, i see in no way XMPP being used to create this upstream message. No XMPP stanza creation. My question deals with where does this XMPP stanza be delivered to? Once it leaves Google's CCS. I see a method on the class that extends FirebaseMessagingService called onMessageReceived. It is my understanding that in this method is where the XMPP stanza will be delievered. Or, will it be delivered on the Smack library connection I intend to set up which will have a PacketListener. According to the example by "Gronkking Android", Google's CCS XMPP stanzas will be delivered here on this packetlistener. I do intend to follow this example to receive these coming stanzas and generate the required ack messages.

If anyone has any thoughts or ideas it would be great to hear your comments

Thank you

解决方案

Device to device messaging is not supported by FCM. Upstream messages are designed to go from your mobile device through CCS to your XMPP app server. Once your XMPP app server receives the message it can decide to send a downstream message through CCS to a mobile device. The XMPP communication with stanzas is done between CCS and your XMPP app server.

这篇关于在Firebase Cloud Messaging上通过XMPP传递上游消息的误解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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