简体   繁体   English

如何在用户之间发送推送通知?

[英]How to send push notification from user to user?

Trying to send push notification from user-to-user, UserA is bidding on the value for an item. 尝试从用户到用户发送推送通知,UserA对项目的价值出价。 Scenario, UserA updates a value in the app and clicks send, and at the same time UserB gets a notification of the updated value. 场景中,UserA更新了应用程序中的值,然后单击发送,同时UserB收到了更新值的通知。

       If UserB approves of the message(value) {
           UserA gets gets the notification of approval and proceeds to 
      final step of buying the item. 
 }  else {
sends no and UserA is updated of the denial and he sends a new value for approval
}

A guide to accomplish the task would be greatly appreciated. 一个指南,以完成这项任务将不胜感激。

PS using firebase as backend 使用Firebase作为后端的PS

Since you are already using Firebase, you have it pretty easy. 由于您已经在使用Firebase,因此非常简单。

This tutorial explains everything you need to do this: 本教程说明了执行此操作所需的一切:

https://www.raywenderlich.com/140836/firebase-tutorial-real-time-chat-2 https://www.raywenderlich.com/140836/firebase-tutorial-real-time-chat-2

Essentially you need to do two things: 本质上,您需要做两件事:

  1. Save data to the Firebase database. 将数据保存到Firebase数据库。 (User A) (用户A)
  2. Listen for new data being saved to the database. 侦听正在保存到数据库的新数据。 (User B) (用户B)

Additionally, the firebase docs themselves explain this pretty well: https://firebase.google.com/docs/cloud-messaging/ios/topic-messaging 此外,firebase文档本身对此进行了很好的解释: https : //firebase.google.com/docs/cloud-messaging/ios/topic-messaging

You can use Firebase with the cloud messaging. 您可以将Firebase与云消息传递一起使用。 So UserA creates the item. 因此, UserA创建该项目。 UserB is interested so he would subscribe to a topic about that item. UserB感兴趣,因此他将订阅有关该项目的主题。

And every time there is an update, he would get a notification. 每次有更新时,他都会收到通知。 Check this https://firebase.google.com/docs/cloud-messaging/ios/topic-messaging 检查此https://firebase.google.com/docs/cloud-messaging/ios/topic-messaging

Sending Push Notifications is done with Apple Push Notification Service. 使用Apple Push Notification Service完成发送Push Notifications。 Apple provides a documentation on how to use APNs. Apple提供了有关如何使用APN的文档

The basic principal is illustrated in this picture. 基本原理如图所示。

苹果关于APN的文档

Sending Messages from one device directly to another is not the way it works. 从一台设备直接向另一台设备发送消息不是它的工作方式。 You have to send a notification to the APNs in order to push them to another devices. 您必须向APN发送通知,以将其推送到其他设备。

Since you are using Firebase I would recommend using Firebase Cloud Messaging to send Push Notifications. 由于您使用的是Firebase,因此建议您使用Firebase Cloud Messaging发送推送通知。

If you just need real time updates in the app Firebase event listeners should work just fine. 如果您只需要在应用程序中进行实时更新, Firebase事件监听器就可以正常工作。

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

相关问题 如何向特定用户发送解析推送通知 - How to send a Parse Push notification to a specific user 快速从用户到用户Firebase发送推送通知 - Swift Send Push Notification from user to user Firebase 如何在通知中心上向特定用户发送推送通知? - How to Send Push Notification to a specific user on Notification Hub? 使用解析将用户的推送通知发送给另一个用户 - Send a push notification from a user to another using parse 无法从 Spring 引导向 FCM 和远程用户发送推送通知? - Cannot send push notification to FCM and to remote user from Spring Boot? 如何在 iOS 中使用 Google Firebase 向特定用户发送推送通知? - How to send push notification to a specific user using Google Firebase in iOS? 如果用户禁用了静默推送通知,该如何发送? - How to send a silent push notification if the user disables them? 向特定用户发送远程推送通知 - Send remote push notification to specific user 如何检查用户是否从设置中启用了推送通知? - How to check if the user has enabled push notification from the settings? 如何查找从我们的服务器发送给用户的Apple推送通知? - How to find the Apple Push Notification Delivered to user or not from our server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM