如何实现MQTT Android中的这个特殊的用例? [英] How to implement MQTT in this particular usecase of Android?

查看:197
本文介绍了如何实现MQTT Android中的这个特殊的用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用例:登录到我的应用程序的用户,应该可以自己登录到其他Android设备上的应用程序发送消息。如果用户有多个设备,那么一旦他打开邮件,对其它设备的通知必须消失。

My usecase: A user logged into my app, should be able to send messages to himself logged into the app on another Android device. If the user has more than one devices, then once he opens the message, the notification on other devices must disappear.

疑惑:


  1. 如何将数据发送到各种设备特定用户?我知道如何使用GCM消息发送到不同的用户在不同的设备,但这似乎相当混乱。

  1. How to send data to a particular user across devices? I understand how to send messages to different users on different devices using GCM but this seems rather confusing.

如何MQTT具有足够的安全性实现这一目标?我读像我看得上的安全性,得到的结论是,MQTT是不是在负责此事,而且我已经落实在经纪人的水平我自己的安全措施。截至目前Mosquitto经纪人允许的用户名/密码认证,但实施中的Oauth一个应用程序,用户名/密码似乎相当脆弱。

How to achieve this in MQTT with adequate security? I read as much as I could about the security and got to the conclusion that MQTT isn't in the charge of it and that I've to implement my own security measures at the broker level. As of now Mosquitto broker allows username/password authentication, but for an app implementing Oauth, username/password seems rather vulnerable.

或者我应该转移到XMPP?

Or should I move over to XMPP?

推荐答案

您可以使用新的用户通知 GCM的功能。

You can use the new User Notifications feature of GCM.

什么是用户通知?

第三方服务器可以发送一条消息给的多实例
  应用程序通过一个单一的用户所拥有的设备上运行。此功能
  所谓的用户通知。用户通知,这使
  一个用户拥有的每个应用程序实例,以反映最新消息
  州。例如:

Third party servers can send a single message to multiple instance of an app running on devices owned by a single user. This feature is called user notifications. User notifications make it possible for every app instance that a user owns to reflect the latest messaging state. For example:


      
  • 如果消息已被一台设备,对其他的GCM信息处理上
      设备被驳回。例如,如果一个用户已经处理了
      一台设备上的日历通知,该通知将消失
      用户的其它设备。

  •   
  • 如果消息尚未交付给一个设备,但它已被处理,该服务器GCM从为未发送队列中删除
      其他设备。

  •   
  • 同样,一个设备可以将消息发送到notification_key,这是令牌GCM使用扇出通知,其注册ID与钥匙相关联的所有设备。

  •   

这篇关于如何实现MQTT Android中的这个特殊的用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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