简体   繁体   English

消息传递服务器如何使目标客户端独立化并发送推送通知

[英]How can a messaging server indetify target client and send push notification

My clients are Android devices. 我的客户是Android设备。 A client wants to send some info to another client which will first be sent to the app server and then the server will notify a middleware service(some kind of message broker) which will be responsible for sending the target client a push notification(to tell it to poll from the app server). 客户端要向其他客户端发送一些信息,该信息首先将发送到应用服务器,然后服务器将通知中间件服务(某种消息代理),该中间件服务将负责向目标客户端发送推送通知(以告知从应用服务器轮询)。
I want to know: 我想知道:
How will this middleware service identify which client device to notify? 该中间件服务将如何识别要通知的客户端设备?
more concretely, How does a push notification server locate which physical device to fire off the notification to? 更具体地讲, 推送通知服务器如何定位向哪个物理设备触发通知?
My requirement is that the client should be able to obtain notifications even while using a VPN or proxy(similar to WhatsApp). 我的要求是,即使使用VPN或代理(类似于WhatsApp),客户端也应该能够获取通知。 Also, if the client is powered off then the middleware queues the messages and delivers them once the client power backs on again. 同样,如果客户端断电,则中间件将消息排队,并在客户端电源再次打开后将其传递。
I have been looking at things like Firebase Cloud Messaging and MQTT brokers and stuff but I want to implement similar things on my own. 我一直在研究诸如Firebase Cloud Messaging和MQTT代理之类的东西,但是我想自己实现类似的东西。
I want to implement this in Java. 我想用Java实现。

Your client ( having an unique id and token ) will send the message to another client who also have a unique id and token in the database .. So the, 您的客户端( 具有唯一的ID和令牌 )会将消息发送给另一个客户端,该客户端在数据库中也具有唯一的ID和令牌 。因此,

Server will map the receivers' id to the receivers token and send the notification to the receiver.. 服务器会将接收者的ID映射到接收者令牌,并将通知发送给接收者。

The database(backend) will have unique ids (maybe primary keys) against each client and also a unique token (for sending notification) against each client. 数据库(后端)将具有针对每个客户端的唯一ID(可能是主键),并且还将具有针对每个客户端的唯一令牌(用于发送通知)。 So , when the sender-client sends the message , the backend script maps the receiver-client's (to whom the sender is sending) id to the receiver clients token. 因此,当发送方-客户端发送消息时,后端脚本会将接收方-客户端(发送方正在向其发送)的id映射到接收方客户端令牌。 Then send the notification to the particular token. 然后将通知发送到特定令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何实现Google Cloud Messaging发送推送通知Android Studio的服务器 - How to implementing server for Google Cloud Messaging to send Push notification android studio 如何使用Cloud Messaging Firebase从服务器推送通知 - How to push notification with Cloud Messaging Firebase from the server 无法发送 Android 消息应用程序的推送通知? - Not able to send push notification for Android messaging app? Java-如何将通知从服务器发送到客户端 - Java - How to send notification from server to client Firebase推送通知云消息传递如何访问附加数据作为通知 - Firebase push notification cloud messaging how to access Additional Data as Notification 如何通过java服务器使用GCM向Android设备发送推送通知? - how to send push notification to the android device using GCM by java server? 如何通过Java服务器使用FCM向Android设备发送推送通知? - how to send push notification to the android device using FCM by java server? 服务器如何将数据推送到客户端? - How can server push data to client? 如何使用Java中的自定义字段发送推送通知? - How can I send a push notification with custom fields from Java? 使用 Java Springboot 服务器和 Expo React 本机客户端发送推送通知 - Send push notification using Java Springboot server and Expo React native client
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM